diff --git a/rustfmt-core/src/lists.rs b/rustfmt-core/src/lists.rs index a67088042c8..3ba702ded91 100644 --- a/rustfmt-core/src/lists.rs +++ b/rustfmt-core/src/lists.rs @@ -616,6 +616,7 @@ fn next(&mut self) -> Option { } } +#[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 2d10be39d09..46d10824fef 100644 --- a/rustfmt-core/src/visitor.rs +++ b/rustfmt-core/src/visitor.rs @@ -200,7 +200,7 @@ pub fn visit_block( 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 @@ pub fn push_str(&mut self, s: &str) { 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);