about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-04-15 20:18:30 +0200
committerMatthias Krüger <matthias.krueger@famsik.de>2023-04-16 13:28:13 +0200
commit543f8bc38c78c05319b5774ec2337c6d3c9b434b (patch)
treeff617ed6f58a0e2622730499574eceb7bbccf461 /compiler/rustc_trait_selection/src
parente6e956dade79bdc084dfe3078abab24656a1b483 (diff)
downloadrust-543f8bc38c78c05319b5774ec2337c6d3c9b434b.tar.gz
rust-543f8bc38c78c05319b5774ec2337c6d3c9b434b.zip
fix clippy::toplevel_ref_arg and ::manual_map
Diffstat (limited to 'compiler/rustc_trait_selection/src')
-rw-r--r--compiler/rustc_trait_selection/src/traits/util.rs9
1 files changed, 2 insertions, 7 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/util.rs b/compiler/rustc_trait_selection/src/traits/util.rs
index 20357d4d250..7792ceabe7e 100644
--- a/compiler/rustc_trait_selection/src/traits/util.rs
+++ b/compiler/rustc_trait_selection/src/traits/util.rs
@@ -243,16 +243,11 @@ pub fn get_vtable_index_of_object_method<'tcx, N>(
 ) -> Option<usize> {
     // Count number of methods preceding the one we are selecting and
     // add them to the total offset.
-    if let Some(index) = tcx
-        .own_existential_vtable_entries(object.upcast_trait_ref.def_id())
+    tcx.own_existential_vtable_entries(object.upcast_trait_ref.def_id())
         .iter()
         .copied()
         .position(|def_id| def_id == method_def_id)
-    {
-        Some(object.vtable_base + index)
-    } else {
-        None
-    }
+        .map(|index| object.vtable_base + index)
 }
 
 pub fn closure_trait_ref_and_return_type<'tcx>(