diff options
Diffstat (limited to 'src/tools/clippy/tests/ui/unused_format_specs.rs')
-rw-r--r-- | src/tools/clippy/tests/ui/unused_format_specs.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/unused_format_specs.rs b/src/tools/clippy/tests/ui/unused_format_specs.rs new file mode 100644 index 000000000..ee192a000 --- /dev/null +++ b/src/tools/clippy/tests/ui/unused_format_specs.rs @@ -0,0 +1,18 @@ +// run-rustfix + +#![warn(clippy::unused_format_specs)] +#![allow(unused)] + +fn main() { + let f = 1.0f64; + println!("{:.}", 1.0); + println!("{f:.} {f:.?}"); + + println!("{:.}", 1); +} + +fn should_not_lint() { + let f = 1.0f64; + println!("{:.1}", 1.0); + println!("{f:.w$} {f:.*?}", 3, w = 2); +} |