Skip to content

Improve lint message in to_string_in_display #5926

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions clippy_lints/src/to_string_in_display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ declare_clippy_lint! {
/// ```
pub TO_STRING_IN_DISPLAY,
correctness,
"to_string method used while implementing Display trait"
"`to_string` method used while implementing `Display` trait"
}

#[derive(Default)]
Expand Down Expand Up @@ -80,7 +80,7 @@ impl LateLintPass<'_> for ToStringInDisplay {
cx,
TO_STRING_IN_DISPLAY,
expr.span,
"Using to_string in fmt::Display implementation might lead to infinite recursion",
"using `to_string` in `fmt::Display` implementation might lead to infinite recursion",
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/lintlist/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2183,7 +2183,7 @@ pub static ref ALL_LINTS: Vec<Lint> = vec![
Lint {
name: "to_string_in_display",
group: "correctness",
desc: "to_string method used while implementing Display trait",
desc: "`to_string` method used while implementing `Display` trait",
deprecation: None,
module: "to_string_in_display",
},
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/to_string_in_display.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: Using to_string in fmt::Display implementation might lead to infinite recursion
error: using `to_string` in `fmt::Display` implementation might lead to infinite recursion
--> $DIR/to_string_in_display.rs:25:25
|
LL | write!(f, "{}", self.to_string())
Expand Down