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 @@ fn try_overflow_last_item(&self, list_items: &mut Vec<ListItem>) -> DefinitiveLi
(true, DefinitiveListTactic::Horizontal, placeholder @ Some(..)) => { (true, DefinitiveListTactic::Horizontal, placeholder @ Some(..)) => {
list_items[self.items.len() - 1].item = placeholder; 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 list_items[self.items.len() - 1].item = self
.items .items
.last() .last()

View File

@ -626,20 +626,19 @@ pub fn visit_attrs(&mut self, attrs: &[ast::Attribute], style: ast::AttrStyle) -
ErrorKind::DeprecatedAttr, ErrorKind::DeprecatedAttr,
)], )],
); );
} else if attr.path.segments[0].ident.to_string() == "rustfmt" { } else if attr.path.segments[0].ident.to_string() == "rustfmt"
if attr.path.segments.len() == 1 && (attr.path.segments.len() == 1
|| attr.path.segments[1].ident.to_string() != "skip" || attr.path.segments[1].ident.to_string() != "skip")
{ {
let file_name = self.source_map.span_to_filename(attr.span).into(); let file_name = self.source_map.span_to_filename(attr.span).into();
self.report.append( self.report.append(
file_name, file_name,
vec![FormattingError::from_span( vec![FormattingError::from_span(
&attr.span, &attr.span,
&self.source_map, &self.source_map,
ErrorKind::BadAttr, ErrorKind::BadAttr,
)], )],
); );
}
} }
} }
if contains_skip(attrs) { if contains_skip(attrs) {