diff --git a/clippy_lints/src/redundant_clone.rs b/clippy_lints/src/redundant_clone.rs index b3988973256..1f134be2cbc 100644 --- a/clippy_lints/src/redundant_clone.rs +++ b/clippy_lints/src/redundant_clone.rs @@ -543,10 +543,10 @@ impl<'a, 'tcx> PossibleBorrowerVisitor<'a, 'tcx> { continue; } - let borrowers = self.possible_borrower.reachable_from(&row); + let borrowers = self.possible_borrower.reachable_from(row); if !borrowers.is_empty() { let mut bs = HybridBitSet::new_empty(self.body.local_decls.len()); - for &c in borrowers { + for c in borrowers { if c != mir::Local::from_usize(0) { bs.insert(c); } @@ -663,10 +663,10 @@ impl<'a, 'tcx> PossibleOriginVisitor<'a, 'tcx> { continue; } - let borrowers = self.possible_origin.reachable_from(&row); + let borrowers = self.possible_origin.reachable_from(row); if !borrowers.is_empty() { let mut bs = HybridBitSet::new_empty(self.body.local_decls.len()); - for &c in borrowers { + for c in borrowers { if c != mir::Local::from_usize(0) { bs.insert(c); } diff --git a/clippy_utils/src/lib.rs b/clippy_utils/src/lib.rs index 397783e309e..8c14f0dd761 100644 --- a/clippy_utils/src/lib.rs +++ b/clippy_utils/src/lib.rs @@ -489,7 +489,8 @@ pub fn def_path_res(cx: &LateContext<'_>, path: &[&str]) -> Res { fn find_crate(tcx: TyCtxt<'_>, name: &str) -> Option { tcx.crates(()) .iter() - .find(|&&num| tcx.crate_name(num).as_str() == name) + .copied() + .find(|&num| tcx.crate_name(num).as_str() == name) .map(CrateNum::as_def_id) }