about summary refs log tree commit diff
path: root/compiler/rustc_borrowck/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-12-18 12:45:56 +0100
committerMatthias Krüger <matthias.krueger@famsik.de>2022-12-19 00:04:28 +0100
commit1da4a499122f59201cf761b79f9e8c6ded1cb91d (patch)
treefceb5fab451f7498a5b942da7d1e9291ba0a2724 /compiler/rustc_borrowck/src
parent48b3c4612681ba7828880aa9e675452c62714bbf (diff)
downloadrust-1da4a499122f59201cf761b79f9e8c6ded1cb91d.tar.gz
rust-1da4a499122f59201cf761b79f9e8c6ded1cb91d.zip
clippy::complexity fixes
filter_next
needless_question_mark
bind_instead_of_map
manual_find
derivable_impls
map_identity
redundant_slicing
skip_while_next
unnecessary_unwrap
needless_bool
Diffstat (limited to 'compiler/rustc_borrowck/src')
-rw-r--r--compiler/rustc_borrowck/src/lib.rs7
1 files changed, 1 insertions, 6 deletions
diff --git a/compiler/rustc_borrowck/src/lib.rs b/compiler/rustc_borrowck/src/lib.rs
index 5289de9b0ab..d8c22fbe59f 100644
--- a/compiler/rustc_borrowck/src/lib.rs
+++ b/compiler/rustc_borrowck/src/lib.rs
@@ -2059,12 +2059,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
     ) -> Option<InitIndex> {
         let mpi = self.move_data.rev_lookup.find_local(local);
         let ii = &self.move_data.init_path_map[mpi];
-        for &index in ii {
-            if flow_state.ever_inits.contains(index) {
-                return Some(index);
-            }
-        }
-        None
+        ii.into_iter().find(|&&index| flow_state.ever_inits.contains(index)).copied()
     }
 
     /// Adds the place into the used mutable variables set