diff --git a/clippy_lints/src/doc.rs b/clippy_lints/src/doc.rs index a00361e6062..16173580fd4 100644 --- a/clippy_lints/src/doc.rs +++ b/clippy_lints/src/doc.rs @@ -628,9 +628,7 @@ fn check_code(cx: &LateContext<'_>, text: &str, edition: Edition, span: Span) { let mut parser = match maybe_new_parser_from_source_str(&sess, filename, code) { Ok(p) => p, Err(errs) => { - for mut err in errs { - err.cancel(); - } + drop(errs); return false; }, }; @@ -668,7 +666,7 @@ fn check_code(cx: &LateContext<'_>, text: &str, edition: Edition, span: Span) { _ => {}, }, Ok(None) => break, - Err(mut e) => { + Err(e) => { e.cancel(); return false; }, diff --git a/clippy_lints/src/write.rs b/clippy_lints/src/write.rs index 1fa6301ebd7..a328ddda5ae 100644 --- a/clippy_lints/src/write.rs +++ b/clippy_lints/src/write.rs @@ -534,7 +534,7 @@ impl Write { match parser .parse_expr() .map(rustc_ast::ptr::P::into_inner) - .map_err(|mut e| e.cancel()) + .map_err(|e| e.cancel()) { // write!(e, ...) Ok(p) if parser.eat(&token::Comma) => Some(p), @@ -563,7 +563,7 @@ impl Write { } let comma_span = parser.prev_token.span; - let token_expr = if let Ok(expr) = parser.parse_expr().map_err(|mut err| err.cancel()) { + let token_expr = if let Ok(expr) = parser.parse_expr().map_err(|err| err.cancel()) { expr } else { return (Some(fmtstr), None);