Closed
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.