]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/clippy_lints/src/dereference.rs
Merge commit '7f27e2e74ef957baa382dc05cf08df6368165c74' into clippyup
[rust.git] / src / tools / clippy / clippy_lints / src / dereference.rs
index f327c9a71b3c1f420e98fe502841ac60f1f58df4..05f2b92c037093affa39e21fe5ac1dc058528cb6 100644 (file)
@@ -1282,10 +1282,10 @@ fn referent_used_exactly_once<'tcx>(
             possible_borrowers.push((body_owner_local_def_id, PossibleBorrowerMap::new(cx, mir)));
         }
         let possible_borrower = &mut possible_borrowers.last_mut().unwrap().1;
-        // If `place.local` were not included here, the `copyable_iterator::warn` test would fail. The
-        // reason is that `PossibleBorrowerVisitor::visit_terminator` considers `place.local` a possible
-        // borrower of itself. See the comment in that method for an explanation as to why.
-        possible_borrower.at_most_borrowers(cx, &[local, place.local], place.local, location)
+        // If `only_borrowers` were used here, the `copyable_iterator::warn` test would fail. The reason is
+        // that `PossibleBorrowerVisitor::visit_terminator` considers `place.local` a possible borrower of
+        // itself. See the comment in that method for an explanation as to why.
+        possible_borrower.bounded_borrowers(&[local], &[local, place.local], place.local, location)
             && used_exactly_once(mir, place.local).unwrap_or(false)
     } else {
         false