about summary refs log tree commit diff
path: root/tests/ui/format.fixed
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-09-14 15:58:21 +0000
committerbors <bors@rust-lang.org>2022-09-14 15:58:21 +0000
commit2ddbc86bef837b1072159c020c35940ce52ae696 (patch)
tree72e4ae3bf5c333d05e259deae907b63f0e5d6436 /tests/ui/format.fixed
parent9c9aa928980ca651a75801b90d814a8fb598ed0a (diff)
parent6fc6d87fd069470893b6a539a46fa1e2f10ae906 (diff)
Auto merge of #8518 - Alexendoo:write-late-pass, r=flip1995
Migrate write.rs to a late pass

changelog: Migrates write.rs from a pre expansion pass to a late pass
changelog: [`positional_named_format_parameters`] is renamed in favour of the rustc lint `named_arguments_used_positionally`

- Macros are now identified by diagnostic items, so will no longer lint user defined macros named, e.g. a custom `print!`
- `print_literal`/`write_literal` no longer lint no longer lint literals that come from macro expansions, e.g. `env!("FOO")`
- `print_with_newline`/`write_with_newline` no longer lint strings with any internal `\r` or `\n`s

~~A false negative, `print_literal`/`write_literal` don't lint format strings that produce `FormatSpec`s, e.g. ones containing pretty print/width/align specifiers~~

Suggestion changes:
- ~~`print_literal`/`write_literal` no longer have suggestions, as the spans for the `{}`s were not easily obtainable~~
-  `print_with_newline`/`write_with_newline` has a better suggestion for a sole literal newline, but no longer has suggestions for len > 1 strings that end in a literal newline
- ~~`use_debug` spans are less precise, now point to the whole format string~~

The diff for write.rs is pretty unwieldy, other than for the `declare_clippy_lint!`s I think you'd be better off viewing it as a brand new file rather than looking at the diff, as it's mostly written from scratch

cc #6610, fixes #5721, fixes #7195, fixes #8615
Diffstat (limited to 'tests/ui/format.fixed')
-rw-r--r--tests/ui/format.fixed4
1 files changed, 0 insertions, 4 deletions
diff --git a/tests/ui/format.fixed b/tests/ui/format.fixed
index b56d6aec508..e0c5f692740 100644
--- a/tests/ui/format.fixed
+++ b/tests/ui/format.fixed
@@ -28,8 +28,6 @@ fn main() {
     format!("{:?}", "foo"); // Don't warn about `Debug`.
     format!("{:8}", "foo");
     format!("{:width$}", "foo", width = 8);
-    "foo".to_string(); // Warn when the format makes no difference.
-    "foo".to_string(); // Warn when the format makes no difference.
     format!("foo {}", "bar");
     format!("{} bar", "foo");
 
@@ -38,8 +36,6 @@ fn main() {
     format!("{:?}", arg); // Don't warn about debug.
     format!("{:8}", arg);
     format!("{:width$}", arg, width = 8);
-    arg.to_string(); // Warn when the format makes no difference.
-    arg.to_string(); // Warn when the format makes no difference.
     format!("foo {}", arg);
     format!("{} bar", arg);