diff --git a/clippy_lints/src/block_in_if_condition.rs b/clippy_lints/src/block_in_if_condition.rs index efea48e6404..6a02e69a881 100644 --- a/clippy_lints/src/block_in_if_condition.rs +++ b/clippy_lints/src/block_in_if_condition.rs @@ -58,9 +58,9 @@ impl<'a, 'tcx: 'a> Visitor<'tcx> for ExVisitor<'a, 'tcx> { fn visit_expr(&mut self, expr: &'tcx Expr) { if let ExprClosure(_, _, eid, _) = expr.node { let body = self.cx.tcx.map.body(eid); - let expr = &body.value; - if matches!(expr.node, ExprBlock(_)) { - self.found_block = Some(&expr); + let ex = &body.value; + if matches!(ex.node, ExprBlock(_)) { + self.found_block = Some(ex); return; } } diff --git a/clippy_lints/src/eta_reduction.rs b/clippy_lints/src/eta_reduction.rs index c00ab3d0e63..19289803299 100644 --- a/clippy_lints/src/eta_reduction.rs +++ b/clippy_lints/src/eta_reduction.rs @@ -50,14 +50,14 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EtaPass { fn check_closure(cx: &LateContext, expr: &Expr) { if let ExprClosure(_, ref decl, eid, _) = expr.node { let body = cx.tcx.map.body(eid); - let ref ex = body.value; + let ex = &body.value; if let ExprCall(ref caller, ref args) = ex.node { if args.len() != decl.inputs.len() { // Not the same number of arguments, there // is no way the closure is the same as the function return; } - if is_adjusted(cx, &ex) || args.iter().any(|arg| is_adjusted(cx, arg)) { + if is_adjusted(cx, ex) || args.iter().any(|arg| is_adjusted(cx, arg)) { // Are the expression or the arguments type-adjusted? Then we need the closure return; } diff --git a/clippy_lints/src/functions.rs b/clippy_lints/src/functions.rs index 24e43373996..36d774b4f9f 100644 --- a/clippy_lints/src/functions.rs +++ b/clippy_lints/src/functions.rs @@ -102,7 +102,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Functions { } } - self.check_raw_ptr(cx, unsafety, decl, &body, nodeid); + self.check_raw_ptr(cx, unsafety, decl, body, nodeid); } fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::TraitItem) { @@ -114,7 +114,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Functions { if let hir::TraitMethod::Provided(eid) = *eid { let body = cx.tcx.map.body(eid); - self.check_raw_ptr(cx, sig.unsafety, &sig.decl, &body, item.id); + self.check_raw_ptr(cx, sig.unsafety, &sig.decl, body, item.id); } } } @@ -141,9 +141,9 @@ impl<'a, 'tcx> Functions { ) { let expr = &body.value; if unsafety == hir::Unsafety::Normal && cx.access_levels.is_exported(nodeid) { - let raw_ptrs = iter_input_pats(&decl, body).zip(decl.inputs.iter()) - .filter_map(|(arg, ty)| raw_ptr_arg(arg, ty)) - .collect::>(); + let raw_ptrs = iter_input_pats(decl, body).zip(decl.inputs.iter()) + .filter_map(|(arg, ty)| raw_ptr_arg(arg, ty)) + .collect::>(); if !raw_ptrs.is_empty() { let mut v = DerefVisitor { diff --git a/clippy_lints/src/lifetimes.rs b/clippy_lints/src/lifetimes.rs index 2c3b06a98c4..3006e5fc9b0 100644 --- a/clippy_lints/src/lifetimes.rs +++ b/clippy_lints/src/lifetimes.rs @@ -137,7 +137,7 @@ fn could_use_elision<'a, 'tcx: 'a, T: Iterator>( // extract lifetimes in input argument types for arg in &func.inputs { - input_visitor.visit_ty(&arg); + input_visitor.visit_ty(arg); } // extract lifetimes in output type if let Return(ref ty) = func.output { diff --git a/clippy_lints/src/shadow.rs b/clippy_lints/src/shadow.rs index e9208a13cf4..a16fe7ae009 100644 --- a/clippy_lints/src/shadow.rs +++ b/clippy_lints/src/shadow.rs @@ -92,7 +92,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { if in_external_macro(cx, body.value.span) { return; } - check_fn(cx, decl, &body); + check_fn(cx, decl, body); } } diff --git a/clippy_lints/src/types.rs b/clippy_lints/src/types.rs index 423071c457a..ae320db63bc 100644 --- a/clippy_lints/src/types.rs +++ b/clippy_lints/src/types.rs @@ -97,7 +97,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypePass { fn check_fn_decl(cx: &LateContext, decl: &FnDecl) { for input in &decl.inputs { - check_ty(cx, &input); + check_ty(cx, input); } if let FunctionRetTy::Return(ref ty) = decl.output { @@ -651,7 +651,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeComplexityPass { impl<'a, 'tcx> TypeComplexityPass { fn check_fndecl(&self, cx: &LateContext<'a, 'tcx>, decl: &'tcx FnDecl) { for arg in &decl.inputs { - self.check_type(cx, &arg); + self.check_type(cx, arg); } if let Return(ref ty) = decl.output { self.check_type(cx, ty);