summaryrefslogtreecommitdiff
path: root/compiler/rustc_ty_utils
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_ty_utils
parente6e956dade79bdc084dfe3078abab24656a1b483 (diff)
downloadrust-543f8bc38c78c05319b5774ec2337c6d3c9b434b.tar.gz
fix clippy::toplevel_ref_arg and ::manual_map
Diffstat (limited to 'compiler/rustc_ty_utils')
-rw-r--r--compiler/rustc_ty_utils/src/instance.rs11
-rw-r--r--compiler/rustc_ty_utils/src/structural_match.rs2
2 files changed, 5 insertions, 8 deletions
diff --git a/compiler/rustc_ty_utils/src/instance.rs b/compiler/rustc_ty_utils/src/instance.rs
index 0a6c118093e..47cd7af221d 100644
--- a/compiler/rustc_ty_utils/src/instance.rs
+++ b/compiler/rustc_ty_utils/src/instance.rs
@@ -234,15 +234,12 @@ fn resolve_associated_item<'tcx>(
_ => None,
},
traits::ImplSource::Object(ref data) => {
- if let Some(index) = traits::get_vtable_index_of_object_method(tcx, data, trait_item_id)
- {
- Some(Instance {
+ traits::get_vtable_index_of_object_method(tcx, data, trait_item_id).map(|index| {
+ Instance {
def: ty::InstanceDef::Virtual(trait_item_id, index),
substs: rcvr_substs,
- })
- } else {
- None
- }
+ }
+ })
}
traits::ImplSource::Builtin(..) => {
let lang_items = tcx.lang_items();
diff --git a/compiler/rustc_ty_utils/src/structural_match.rs b/compiler/rustc_ty_utils/src/structural_match.rs
index a55bb7e7e90..9cb0fc10594 100644
--- a/compiler/rustc_ty_utils/src/structural_match.rs
+++ b/compiler/rustc_ty_utils/src/structural_match.rs
@@ -13,7 +13,7 @@ use rustc_trait_selection::traits::{ObligationCause, ObligationCtxt};
/// Note that this does *not* recursively check if the substructure of `adt_ty`
/// implements the traits.
fn has_structural_eq_impls<'tcx>(tcx: TyCtxt<'tcx>, adt_ty: Ty<'tcx>) -> bool {
- let ref infcx = tcx.infer_ctxt().build();
+ let infcx = &tcx.infer_ctxt().build();
let cause = ObligationCause::dummy();
let ocx = ObligationCtxt::new(infcx);