Skip to content

Commit

Permalink
Rollup merge of rust-lang#97079 - SparrowLii:successors, r=lcnr
Browse files Browse the repository at this point in the history
Change `Successors` to `impl Iterator<Item = BasicBlock>`

This PR fixes the FIXME in `compiler\rustc_middle\src\mir\mod.rs`.
This can omit several `&`, `*` or `cloned` operations on Successros' generated elements
  • Loading branch information
JohnTitor authored May 17, 2022
2 parents 7062eb4 + d7a6654 commit ae9d727
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions clippy_lints/src/redundant_clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ impl<'tcx> LateLintPass<'tcx> for RedundantClone {
}

// Give up on loops
if terminator.successors().any(|s| *s == bb) {
if terminator.successors().any(|s| s == bb) {
continue;
}

Expand Down Expand Up @@ -440,7 +440,7 @@ fn visit_clone_usage(cloned: mir::Local, clone: mir::Local, mir: &mir::Body<'_>,
// Short-circuit
if (usage.cloned_used && usage.clone_consumed_or_mutated) ||
// Give up on loops
tdata.terminator().successors().any(|s| *s == bb)
tdata.terminator().successors().any(|s| s == bb)
{
return CloneUsage {
cloned_used: true,
Expand Down

0 comments on commit ae9d727

Please sign in to comment.