Skip to content

Commit 7b595f9

Browse files
committed
minor clean up
1 parent cfcf4ca commit 7b595f9

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

compiler/rustc_trait_selection/src/error_reporting/infer/need_type_info.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -662,9 +662,9 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
662662

663663
fn get_suggestions(
664664
&self,
665-
ty: Ty<'tcx>, // args.type_at(0) / ty
665+
self_ty: Ty<'tcx>,
666666
def_id: DefId,
667-
target_type: bool, // false / true
667+
target_type: bool,
668668
param_env: ty::ParamEnv<'tcx>,
669669
args: Option<&ty::GenericArgs<'tcx>>,
670670
) -> Vec<String> {
@@ -685,13 +685,13 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
685685
let args = args.unwrap_or_else(|| empty_args(def_id));
686686
tcx.for_each_relevant_impl(
687687
tcx.parent(def_id), // Trait `DefId`
688-
ty, // `Self` type
688+
self_ty,
689689
|impl_def_id| {
690690
let impl_args = empty_args(impl_def_id);
691691
let impl_trait_ref =
692692
tcx.impl_trait_ref(impl_def_id).unwrap().instantiate(tcx, impl_args);
693693
let impl_self_ty = impl_trait_ref.self_ty();
694-
if self.infcx.can_eq(param_env, impl_self_ty, ty) {
694+
if self.infcx.can_eq(param_env, impl_self_ty, self_ty) {
695695
// The expr's self type could conform to this impl's self type.
696696
} else {
697697
// Nope, don't bother.
@@ -714,12 +714,12 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
714714
return;
715715
};
716716
let target = header.trait_ref.skip_binder().args.type_at(0);
717-
let _ty = header.trait_ref.skip_binder().args.type_at(1);
718-
if _ty == ty {
717+
let ty = header.trait_ref.skip_binder().args.type_at(1);
718+
if ty == self_ty {
719719
if target_type {
720720
paths.push(format!("{target}"));
721721
} else {
722-
paths.push(format!("<{ty} as Into<{target}>>::into"));
722+
paths.push(format!("<{self_ty} as Into<{target}>>::into"));
723723
}
724724
found = true;
725725
}

0 commit comments

Comments
 (0)