about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2022-05-17 19:01:32 +0900
committerGitHub <noreply@github.com>2022-05-17 19:01:32 +0900
commitae9d727b8db5bc8c9e052f4dd43f606039d22738 (patch)
tree3a8f151a0cf77cd14aee74becfe7ba274533ef42
parent7062eb4e149c7ab75dff4367c6d93e27bfb8f7a8 (diff)
parentd7a6654580d5765777afd31b00110f87893825d0 (diff)
downloadrust-ae9d727b8db5bc8c9e052f4dd43f606039d22738.tar.gz
rust-ae9d727b8db5bc8c9e052f4dd43f606039d22738.zip
Rollup merge of #97079 - SparrowLii:successors, r=lcnr
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
-rw-r--r--clippy_lints/src/redundant_clone.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/clippy_lints/src/redundant_clone.rs b/clippy_lints/src/redundant_clone.rs
index 1507c75ff61..37aac8b2a49 100644
--- a/clippy_lints/src/redundant_clone.rs
+++ b/clippy_lints/src/redundant_clone.rs
@@ -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;
             }
 
@@ -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,