fix clippy::toplevel_ref_arg and ::manual_map

This commit is contained in:
Matthias Krüger 2023-04-15 20:18:30 +02:00
parent e6e956dade
commit 543f8bc38c
12 changed files with 42 additions and 70 deletions

View file

@ -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();

View file

@ -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);