Tweak wording and logic
This commit is contained in:
parent
0e98682576
commit
ac5e18756a
@ -243,15 +243,20 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
|
|||||||
));
|
));
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
AssocItemKind::Fn(fn_) => Some((
|
AssocItemKind::Fn(fn_) if fn_.sig.decl.has_self() => Some((
|
||||||
sp,
|
sp,
|
||||||
"consider using the associated function",
|
"consider using the method on `Self`",
|
||||||
if fn_.sig.decl.has_self() { "self." } else { "Self::" },
|
"self.".to_string(),
|
||||||
|
)),
|
||||||
|
AssocItemKind::Fn(_) => Some((
|
||||||
|
sp,
|
||||||
|
"consider using the associated function on `Self`",
|
||||||
|
"Self::".to_string(),
|
||||||
)),
|
)),
|
||||||
AssocItemKind::Const(..) => Some((
|
AssocItemKind::Const(..) => Some((
|
||||||
sp,
|
sp,
|
||||||
"consider using the associated constant",
|
"consider using the associated constant on `Self`",
|
||||||
"Self::",
|
"Self::".to_string(),
|
||||||
)),
|
)),
|
||||||
_ => None
|
_ => None
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ error[E0425]: cannot find function `first` in this scope
|
|||||||
LL | first()
|
LL | first()
|
||||||
| ^^^^^ not found in this scope
|
| ^^^^^ not found in this scope
|
||||||
|
|
|
|
||||||
help: consider using the associated function
|
help: consider using the method on `Self`
|
||||||
|
|
|
|
||||||
LL | self.first()
|
LL | self.first()
|
||||||
| +++++
|
| +++++
|
||||||
|
@ -73,7 +73,7 @@ error[E0425]: cannot find function `static_method` in this scope
|
|||||||
LL | static_method();
|
LL | static_method();
|
||||||
| ^^^^^^^^^^^^^ not found in this scope
|
| ^^^^^^^^^^^^^ not found in this scope
|
||||||
|
|
|
|
||||||
help: consider using the associated function
|
help: consider using the associated function on `Self`
|
||||||
|
|
|
|
||||||
LL | Self::static_method();
|
LL | Self::static_method();
|
||||||
| ++++++
|
| ++++++
|
||||||
@ -102,7 +102,7 @@ error[E0425]: cannot find function `grow_older` in this scope
|
|||||||
LL | grow_older();
|
LL | grow_older();
|
||||||
| ^^^^^^^^^^ not found in this scope
|
| ^^^^^^^^^^ not found in this scope
|
||||||
|
|
|
|
||||||
help: consider using the associated function
|
help: consider using the associated function on `Self`
|
||||||
|
|
|
|
||||||
LL | Self::grow_older();
|
LL | Self::grow_older();
|
||||||
| ++++++
|
| ++++++
|
||||||
|
@ -10,7 +10,7 @@ error[E0425]: cannot find function `sleep` in this scope
|
|||||||
LL | sleep();
|
LL | sleep();
|
||||||
| ^^^^^ not found in this scope
|
| ^^^^^ not found in this scope
|
||||||
|
|
|
|
||||||
help: consider using the associated function
|
help: consider using the method on `Self`
|
||||||
|
|
|
|
||||||
LL | self.sleep();
|
LL | self.sleep();
|
||||||
| +++++
|
| +++++
|
||||||
|
@ -4,7 +4,7 @@ error[E0425]: cannot find value `A_CONST` in this scope
|
|||||||
LL | A_CONST
|
LL | A_CONST
|
||||||
| ^^^^^^^ not found in this scope
|
| ^^^^^^^ not found in this scope
|
||||||
|
|
|
|
||||||
help: consider using the associated constant
|
help: consider using the associated constant on `Self`
|
||||||
|
|
|
|
||||||
LL | Self::A_CONST
|
LL | Self::A_CONST
|
||||||
| ++++++
|
| ++++++
|
||||||
|
@ -4,7 +4,7 @@ error[E0425]: cannot find function `foo` in this scope
|
|||||||
LL | foo();
|
LL | foo();
|
||||||
| ^^^ not found in this scope
|
| ^^^ not found in this scope
|
||||||
|
|
|
|
||||||
help: consider using the associated function
|
help: consider using the associated function on `Self`
|
||||||
|
|
|
|
||||||
LL | Self::foo();
|
LL | Self::foo();
|
||||||
| ++++++
|
| ++++++
|
||||||
@ -24,7 +24,7 @@ error[E0425]: cannot find function `baz` in this scope
|
|||||||
LL | baz(2, 3);
|
LL | baz(2, 3);
|
||||||
| ^^^ not found in this scope
|
| ^^^ not found in this scope
|
||||||
|
|
|
|
||||||
help: consider using the associated function
|
help: consider using the associated function on `Self`
|
||||||
|
|
|
|
||||||
LL | Self::baz(2, 3);
|
LL | Self::baz(2, 3);
|
||||||
| ++++++
|
| ++++++
|
||||||
@ -41,7 +41,7 @@ error[E0425]: cannot find function `foo` in this scope
|
|||||||
LL | foo();
|
LL | foo();
|
||||||
| ^^^ not found in this scope
|
| ^^^ not found in this scope
|
||||||
|
|
|
|
||||||
help: consider using the associated function
|
help: consider using the associated function on `Self`
|
||||||
|
|
|
|
||||||
LL | Self::foo();
|
LL | Self::foo();
|
||||||
| ++++++
|
| ++++++
|
||||||
@ -52,7 +52,7 @@ error[E0425]: cannot find function `bar` in this scope
|
|||||||
LL | bar();
|
LL | bar();
|
||||||
| ^^^ not found in this scope
|
| ^^^ not found in this scope
|
||||||
|
|
|
|
||||||
help: consider using the associated function
|
help: consider using the method on `Self`
|
||||||
|
|
|
|
||||||
LL | self.bar();
|
LL | self.bar();
|
||||||
| +++++
|
| +++++
|
||||||
@ -63,7 +63,7 @@ error[E0425]: cannot find function `baz` in this scope
|
|||||||
LL | baz(2, 3);
|
LL | baz(2, 3);
|
||||||
| ^^^ not found in this scope
|
| ^^^ not found in this scope
|
||||||
|
|
|
|
||||||
help: consider using the associated function
|
help: consider using the associated function on `Self`
|
||||||
|
|
|
|
||||||
LL | Self::baz(2, 3);
|
LL | Self::baz(2, 3);
|
||||||
| ++++++
|
| ++++++
|
||||||
|
Loading…
x
Reference in New Issue
Block a user