Skip to content

Commit

Permalink
minor: pick a suitable var name
Browse files Browse the repository at this point in the history
  • Loading branch information
Young-Flash committed Jan 27, 2024
1 parent c0a5a85 commit 8b3a681
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_hir_typeck/src/method/suggest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1588,7 +1588,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
};
if let SelfSource::MethodCall(_) = source {
let first_arg = static_candidates.get(0).and_then(|candidate_source| {
let (assoc_did, impl_ty) = match candidate_source {
let (assoc_did, self_ty) = match candidate_source {
CandidateSource::Impl(impl_did) => {
(*impl_did, self.tcx.type_of(*impl_did).instantiate_identity())
}
Expand All @@ -1606,7 +1606,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
sig.inputs().skip_binder().get(0).and_then(|first| {
// if the type of first arg is the same as the current impl type, we should take the first arg into assoc function
let first_ty = first.peel_refs();
if first_ty == impl_ty || first_ty == self.tcx.types.self_param {
if first_ty == self_ty || first_ty == self.tcx.types.self_param {
Some(first.ref_mutability().map_or("", |mutbl| mutbl.ref_prefix_str()))
} else {
None
Expand Down

0 comments on commit 8b3a681

Please sign in to comment.