more clippy

This commit is contained in:
Maximilian Roos 2018-08-28 21:57:08 -04:00
parent df72570b58
commit 7d60e3a1ad
No known key found for this signature in database
GPG key ID: 3232F28BEDA66FCD
2 changed files with 14 additions and 15 deletions

View file

@ -291,7 +291,7 @@ impl<'a, T: 'a + Rewrite + ToExpr + Spanned> Context<'a, T> {
(true, DefinitiveListTactic::Horizontal, placeholder @ Some(..)) => {
list_items[self.items.len() - 1].item = placeholder;
}
_ if self.items.len() >= 1 => {
_ if !self.items.is_empty() => {
list_items[self.items.len() - 1].item = self
.items
.last()

View file

@ -626,20 +626,19 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
ErrorKind::DeprecatedAttr,
)],
);
} else if attr.path.segments[0].ident.to_string() == "rustfmt" {
if attr.path.segments.len() == 1
|| attr.path.segments[1].ident.to_string() != "skip"
{
let file_name = self.source_map.span_to_filename(attr.span).into();
self.report.append(
file_name,
vec![FormattingError::from_span(
&attr.span,
&self.source_map,
ErrorKind::BadAttr,
)],
);
}
} else if attr.path.segments[0].ident.to_string() == "rustfmt"
&& (attr.path.segments.len() == 1
|| attr.path.segments[1].ident.to_string() != "skip")
{
let file_name = self.source_map.span_to_filename(attr.span).into();
self.report.append(
file_name,
vec![FormattingError::from_span(
&attr.span,
&self.source_map,
ErrorKind::BadAttr,
)],
);
}
}
if contains_skip(attrs) {