summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/to_string_in_format_args.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/src/docs/to_string_in_format_args.txt')
-rw-r--r--src/tools/clippy/src/docs/to_string_in_format_args.txt17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/to_string_in_format_args.txt b/src/tools/clippy/src/docs/to_string_in_format_args.txt
new file mode 100644
index 000000000..34b205835
--- /dev/null
+++ b/src/tools/clippy/src/docs/to_string_in_format_args.txt
@@ -0,0 +1,17 @@
+### What it does
+Checks for [`ToString::to_string`](https://doc.rust-lang.org/std/string/trait.ToString.html#tymethod.to_string)
+applied to a type that implements [`Display`](https://doc.rust-lang.org/std/fmt/trait.Display.html)
+in a macro that does formatting.
+
+### Why is this bad?
+Since the type implements `Display`, the use of `to_string` is
+unnecessary.
+
+### Example
+```
+println!("error: something failed at {}", Location::caller().to_string());
+```
+Use instead:
+```
+println!("error: something failed at {}", Location::caller());
+``` \ No newline at end of file