minor: pick a suitable var name

This commit is contained in:
Young-Flash 2024-01-27 10:24:45 +08:00
parent c0a5a859b9
commit 8b3a681a34

View File

@ -1588,7 +1588,7 @@ fn suggest_associated_call_syntax(
}; };
if let SelfSource::MethodCall(_) = source { if let SelfSource::MethodCall(_) = source {
let first_arg = static_candidates.get(0).and_then(|candidate_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) => { CandidateSource::Impl(impl_did) => {
(*impl_did, self.tcx.type_of(*impl_did).instantiate_identity()) (*impl_did, self.tcx.type_of(*impl_did).instantiate_identity())
} }
@ -1606,7 +1606,7 @@ fn suggest_associated_call_syntax(
sig.inputs().skip_binder().get(0).and_then(|first| { 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 // 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(); 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())) Some(first.ref_mutability().map_or("", |mutbl| mutbl.ref_prefix_str()))
} else { } else {
None None