diff --git a/src/overflow.rs b/src/overflow.rs index 9a9c9831f40..674eb14b677 100644 --- a/src/overflow.rs +++ b/src/overflow.rs @@ -291,7 +291,7 @@ fn try_overflow_last_item(&self, list_items: &mut Vec) -> DefinitiveLi (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() diff --git a/src/visitor.rs b/src/visitor.rs index 7f557747778..4373fc048ea 100644 --- a/src/visitor.rs +++ b/src/visitor.rs @@ -626,20 +626,19 @@ pub fn visit_attrs(&mut self, attrs: &[ast::Attribute], style: ast::AttrStyle) - 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) {