diff --git a/rustfmt-core/src/lists.rs b/rustfmt-core/src/lists.rs index a67088042c8a..3ba702ded918 100644 --- a/rustfmt-core/src/lists.rs +++ b/rustfmt-core/src/lists.rs @@ -616,6 +616,7 @@ where } } +#[cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))] // Creates an iterator over a list's items with associated comments. pub fn itemize_list<'a, T, I, F1, F2, F3>( codemap: &'a CodeMap, diff --git a/rustfmt-core/src/visitor.rs b/rustfmt-core/src/visitor.rs index 0a0d59d0f02c..9e5ce1c3b310 100644 --- a/rustfmt-core/src/visitor.rs +++ b/rustfmt-core/src/visitor.rs @@ -200,7 +200,7 @@ impl<'b, 'a: 'b> FmtVisitor<'a> { let snippet = self.snippet(mk_sp( self.last_pos, - attr_lo.unwrap_or(first_stmt.span.lo()), + attr_lo.unwrap_or_else(|| first_stmt.span.lo()), )); let len = CommentCodeSlices::new(snippet) .nth(0) @@ -568,6 +568,7 @@ impl<'b, 'a: 'b> FmtVisitor<'a> { self.buffer.push_str(s); } + #[cfg_attr(feature = "cargo-clippy", allow(needless_pass_by_value))] fn push_rewrite_inner(&mut self, span: Span, rewrite: Option) { if let Some(ref s) = rewrite { self.push_str(s);