1
Fork 0

Tweak wording and logic

This commit is contained in:
Esteban Küber 2023-09-23 01:54:05 +00:00
parent 0e98682576
commit ac5e18756a
6 changed files with 20 additions and 15 deletions

View file

@ -243,15 +243,20 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
));
None
}
AssocItemKind::Fn(fn_) => Some((
AssocItemKind::Fn(fn_) if fn_.sig.decl.has_self() => Some((
sp,
"consider using the associated function",
if fn_.sig.decl.has_self() { "self." } else { "Self::" },
"consider using the method on `Self`",
"self.".to_string(),
)),
AssocItemKind::Fn(_) => Some((
sp,
"consider using the associated function on `Self`",
"Self::".to_string(),
)),
AssocItemKind::Const(..) => Some((
sp,
"consider using the associated constant",
"Self::",
"consider using the associated constant on `Self`",
"Self::".to_string(),
)),
_ => None
}