declare_clippy_lint! {
/// ### What it does
- /// It lints if a struct has two method with same time:
+ /// It lints if a struct has two methods with the same name:
/// one from a trait, another not from trait.
///
/// ### Why is this bad?
/// fn foo(&self) {}
/// }
/// ```
+ #[clippy::version = "1.57.0"]
pub SAME_NAME_METHOD,
restriction,
"two method with same name"
.filter(|assoc_item| {
matches!(assoc_item.kind, AssocKind::Fn)
})
- .map(|assoc_item| assoc_item.ident.name)
+ .map(|assoc_item| assoc_item.name)
.collect()
}else{
BTreeSet::new()
cx,
SAME_NAME_METHOD,
*impl_span,
- "method's name is same to an existing method in a trait",
+ "method's name is the same as an existing method in a trait",
|diag| {
diag.span_note(
trait_method_span,
cx,
SAME_NAME_METHOD,
impl_span,
- "method's name is same to an existing method in a trait",
+ "method's name is the same as an existing method in a trait",
|diag| {
// TODO should we `span_note` on every trait?
// iterate on trait_spans?