/// }
/// }
/// ```
+ #[clippy::version = "1.38.0"]
pub INHERENT_TO_STRING,
style,
"type implements inherent method `to_string()`, but should instead implement the `Display` trait"
/// }
/// }
/// ```
+ #[clippy::version = "1.38.0"]
pub INHERENT_TO_STRING_SHADOW_DISPLAY,
correctness,
"type implements inherent method `to_string()`, which gets shadowed by the implementation of the `Display` trait"
item.span,
&format!(
"type `{}` implements inherent method `to_string(&self) -> String` which shadows the implementation of `Display`",
- self_type.to_string()
+ self_type
),
None,
- &format!("remove the inherent method from type `{}`", self_type.to_string()),
+ &format!("remove the inherent method from type `{}`", self_type),
);
} else {
span_lint_and_help(
item.span,
&format!(
"implementation of inherent method `to_string(&self) -> String` for type `{}`",
- self_type.to_string()
+ self_type
),
None,
- &format!("implement trait `Display` for type `{}` instead", self_type.to_string()),
+ &format!("implement trait `Display` for type `{}` instead", self_type),
);
}
}