-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
A-lintArea: New lintsArea: New lintsL-correctnessLint: Belongs in the correctness lint groupLint: Belongs in the correctness lint groupL-styleLint: Belongs in the style lint groupLint: Belongs in the style lint groupgood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy
Description
Emit a lint when a type defines an inherent to_string()
method. One should implement Display
instead.
impl S {
fn to_string(&self) -> String { ... }
// ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
}
If a type both implements Display
and defines an inherent to_string()
method, turn up the warn level to error, since the inherent to_string()
will shadow the Display
impl and they may behave differently.
Do not emit the lint if to_string()
is a trait method or free function.
Do not emit the lint if the method is not exactly fn(&self) -> String
, or maybe still emit a lint but suggest renaming the method.
killercup, mati865, jhpratt and matthiaskrgr
Metadata
Metadata
Assignees
Labels
A-lintArea: New lintsArea: New lintsL-correctnessLint: Belongs in the correctness lint groupLint: Belongs in the correctness lint groupL-styleLint: Belongs in the style lint groupLint: Belongs in the style lint groupgood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy