diff options
| author | bors <bors@rust-lang.org> | 2022-08-03 04:50:42 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-08-03 04:50:42 +0000 |
| commit | e141246cbbce2a6001f3181d3d0f661bbfd9c7ea (patch) | |
| tree | 1b5d478cb8ea19987952a47af2df2cc043294443 /src/test | |
| parent | b759b2efad2d9c713eeab19bf90736a12ff0d74c (diff) | |
| parent | e20f7f83c04e03ee0e758394092794ff2f3e332e (diff) | |
| download | rust-e141246cbbce2a6001f3181d3d0f661bbfd9c7ea.tar.gz rust-e141246cbbce2a6001f3181d3d0f661bbfd9c7ea.zip | |
Auto merge of #100082 - matthiaskrgr:rollup-ywu4iux, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #99933 (parallelize HTML checking tool) - #99958 (Improve position named arguments lint underline and formatting names) - #100008 (Update all pre-cloned submodules on startup) - #100049 (:arrow_up: rust-analyzer) - #100070 (Clarify Cargo.toml comments) - #100074 (rustc-docs: Be less specific about the representation of `+bundle`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/macros/issue-98466.stderr | 36 | ||||
| -rw-r--r-- | src/test/ui/macros/issue-99265.stderr | 172 | ||||
| -rw-r--r-- | src/test/ui/macros/issue-99907.fixed | 24 | ||||
| -rw-r--r-- | src/test/ui/macros/issue-99907.rs | 24 | ||||
| -rw-r--r-- | src/test/ui/macros/issue-99907.stderr | 68 |
5 files changed, 220 insertions, 104 deletions
diff --git a/src/test/ui/macros/issue-98466.stderr b/src/test/ui/macros/issue-98466.stderr index 4a39dd1440b..c93451c761a 100644 --- a/src/test/ui/macros/issue-98466.stderr +++ b/src/test/ui/macros/issue-98466.stderr @@ -2,9 +2,9 @@ warning: named argument `_x` is not used by name --> $DIR/issue-98466.rs:7:26 | LL | println!("_x is {}", _x = 5); - | - ^^ this named argument is only referred to by position in formatting string - | | - | this formatting argument uses named argument `_x` by position + | -- ^^ this named argument is referred to by position in formatting string + | | + | this formatting argument uses named argument `_x` by position | = note: `#[warn(named_arguments_used_positionally)]` on by default help: use the named argument by name to avoid ambiguity @@ -16,9 +16,9 @@ warning: named argument `y` is not used by name --> $DIR/issue-98466.rs:10:26 | LL | println!("_x is {}", y = _x); - | - ^ this named argument is only referred to by position in formatting string - | | - | this formatting argument uses named argument `y` by position + | -- ^ this named argument is referred to by position in formatting string + | | + | this formatting argument uses named argument `y` by position | help: use the named argument by name to avoid ambiguity | @@ -29,9 +29,9 @@ warning: named argument `y` is not used by name --> $DIR/issue-98466.rs:13:83 | LL | println!("first positional arg {}, second positional arg {}, _x is {}", 1, 2, y = _x); - | - ^ this named argument is only referred to by position in formatting string - | | - | this formatting argument uses named argument `y` by position + | -- ^ this named argument is referred to by position in formatting string + | | + | this formatting argument uses named argument `y` by position | help: use the named argument by name to avoid ambiguity | @@ -42,9 +42,9 @@ warning: named argument `_x` is not used by name --> $DIR/issue-98466.rs:19:34 | LL | let _f = format!("_x is {}", _x = 5); - | - ^^ this named argument is only referred to by position in formatting string - | | - | this formatting argument uses named argument `_x` by position + | -- ^^ this named argument is referred to by position in formatting string + | | + | this formatting argument uses named argument `_x` by position | help: use the named argument by name to avoid ambiguity | @@ -55,9 +55,9 @@ warning: named argument `y` is not used by name --> $DIR/issue-98466.rs:22:34 | LL | let _f = format!("_x is {}", y = _x); - | - ^ this named argument is only referred to by position in formatting string - | | - | this formatting argument uses named argument `y` by position + | -- ^ this named argument is referred to by position in formatting string + | | + | this formatting argument uses named argument `y` by position | help: use the named argument by name to avoid ambiguity | @@ -68,9 +68,9 @@ warning: named argument `y` is not used by name --> $DIR/issue-98466.rs:25:91 | LL | let _f = format!("first positional arg {}, second positional arg {}, _x is {}", 1, 2, y = _x); - | - ^ this named argument is only referred to by position in formatting string - | | - | this formatting argument uses named argument `y` by position + | -- ^ this named argument is referred to by position in formatting string + | | + | this formatting argument uses named argument `y` by position | help: use the named argument by name to avoid ambiguity | diff --git a/src/test/ui/macros/issue-99265.stderr b/src/test/ui/macros/issue-99265.stderr index 0798ad8dc51..2bfeedd7d07 100644 --- a/src/test/ui/macros/issue-99265.stderr +++ b/src/test/ui/macros/issue-99265.stderr @@ -2,9 +2,9 @@ warning: named argument `a` is not used by name --> $DIR/issue-99265.rs:5:24 | LL | println!("{b} {}", a=1, b=2); - | - ^ this named argument is only referred to by position in formatting string - | | - | this formatting argument uses named argument `a` by position + | -- ^ this named argument is referred to by position in formatting string + | | + | this formatting argument uses named argument `a` by position | = note: `#[warn(named_arguments_used_positionally)]` on by default help: use the named argument by name to avoid ambiguity @@ -16,9 +16,9 @@ warning: named argument `a` is not used by name --> $DIR/issue-99265.rs:9:35 | LL | println!("{} {} {} {} {}", 0, a=1, b=2, c=3, d=4); - | - ^ this named argument is only referred to by position in formatting string - | | - | this formatting argument uses named argument `a` by position + | -- ^ this named argument is referred to by position in formatting string + | | + | this formatting argument uses named argument `a` by position | help: use the named argument by name to avoid ambiguity | @@ -29,9 +29,9 @@ warning: named argument `b` is not used by name --> $DIR/issue-99265.rs:9:40 | LL | println!("{} {} {} {} {}", 0, a=1, b=2, c=3, d=4); - | - ^ this named argument is only referred to by position in formatting string - | | - | this formatting argument uses named argument `b` by position + | -- ^ this named argument is referred to by position in formatting string + | | + | this formatting argument uses named argument `b` by position | help: use the named argument by name to avoid ambiguity | @@ -42,9 +42,9 @@ warning: named argument `c` is not used by name --> $DIR/issue-99265.rs:9:45 | LL | println!("{} {} {} {} {}", 0, a=1, b=2, c=3, d=4); - | - ^ this named argument is only referred to by position in formatting string - | | - | this formatting argument uses named argument `c` by position + | -- ^ this named argument is referred to by position in formatting string + | | + | this formatting argument uses named argument `c` by position | help: use the named argument by name to avoid ambiguity | @@ -55,9 +55,9 @@ warning: named argument `d` is not used by name --> $DIR/issue-99265.rs:9:50 | LL | println!("{} {} {} {} {}", 0, a=1, b=2, c=3, d=4); - | - ^ this named argument is only referred to by position in formatting string - | | - | this formatting argument uses named argument `d` by position + | -- ^ this named argument is referred to by position in formatting string + | | + | this formatting argument uses named argument `d` by position | help: use the named argument by name to avoid ambiguity | @@ -68,9 +68,9 @@ warning: named argument `width` is not used by name --> $DIR/issue-99265.rs:19:35 | LL | println!("Hello {:1$}!", "x", width = 5); - | -- ^^^^^ this named argument is only referred to by position in formatting string + | -- ^^^^^ this named argument is referred to by position in formatting string | | - | this formatting argument uses named argument `width$` by position + | this formatting argument uses named argument `width` by position | help: use the named argument by name to avoid ambiguity | @@ -81,9 +81,9 @@ warning: named argument `width` is not used by name --> $DIR/issue-99265.rs:23:46 | LL | println!("Hello {:1$.2$}!", f = 0.02f32, width = 5, precision = 2); - | -- ^^^^^ this named argument is only referred to by position in formatting string + | -- ^^^^^ this named argument is referred to by position in formatting string | | - | this formatting argument uses named argument `width$` by position + | this formatting argument uses named argument `width` by position | help: use the named argument by name to avoid ambiguity | @@ -94,9 +94,9 @@ warning: named argument `precision` is not used by name --> $DIR/issue-99265.rs:23:57 | LL | println!("Hello {:1$.2$}!", f = 0.02f32, width = 5, precision = 2); - | -- ^^^^^^^^^ this named argument is only referred to by position in formatting string + | -- ^^^^^^^^^ this named argument is referred to by position in formatting string | | - | this formatting argument uses named argument `precision$` by position + | this formatting argument uses named argument `precision` by position | help: use the named argument by name to avoid ambiguity | @@ -107,9 +107,9 @@ warning: named argument `f` is not used by name --> $DIR/issue-99265.rs:23:33 | LL | println!("Hello {:1$.2$}!", f = 0.02f32, width = 5, precision = 2); - | - ^ this named argument is only referred to by position in formatting string - | | - | this formatting argument uses named argument `f` by position + | -- ^ this named argument is referred to by position in formatting string + | | + | this formatting argument uses named argument `f` by position | help: use the named argument by name to avoid ambiguity | @@ -120,9 +120,9 @@ warning: named argument `width` is not used by name --> $DIR/issue-99265.rs:31:47 | LL | println!("Hello {0:1$.2$}!", f = 0.02f32, width = 5, precision = 2); - | -- ^^^^^ this named argument is only referred to by position in formatting string + | -- ^^^^^ this named argument is referred to by position in formatting string | | - | this formatting argument uses named argument `width$` by position + | this formatting argument uses named argument `width` by position | help: use the named argument by name to avoid ambiguity | @@ -133,9 +133,9 @@ warning: named argument `precision` is not used by name --> $DIR/issue-99265.rs:31:58 | LL | println!("Hello {0:1$.2$}!", f = 0.02f32, width = 5, precision = 2); - | -- ^^^^^^^^^ this named argument is only referred to by position in formatting string + | -- ^^^^^^^^^ this named argument is referred to by position in formatting string | | - | this formatting argument uses named argument `precision$` by position + | this formatting argument uses named argument `precision` by position | help: use the named argument by name to avoid ambiguity | @@ -146,7 +146,7 @@ warning: named argument `f` is not used by name --> $DIR/issue-99265.rs:31:34 | LL | println!("Hello {0:1$.2$}!", f = 0.02f32, width = 5, precision = 2); - | - ^ this named argument is only referred to by position in formatting string + | - ^ this named argument is referred to by position in formatting string | | | this formatting argument uses named argument `f` by position | @@ -159,10 +159,10 @@ warning: named argument `width` is not used by name --> $DIR/issue-99265.rs:52:9 | LL | "{}, Hello {1:2$.3$} {4:5$.6$}! {1}", - | -- this formatting argument uses named argument `width$` by position + | -- this formatting argument uses named argument `width` by position ... LL | width = 5, - | ^^^^^ this named argument is only referred to by position in formatting string + | ^^^^^ this named argument is referred to by position in formatting string | help: use the named argument by name to avoid ambiguity | @@ -173,10 +173,10 @@ warning: named argument `precision` is not used by name --> $DIR/issue-99265.rs:54:9 | LL | "{}, Hello {1:2$.3$} {4:5$.6$}! {1}", - | -- this formatting argument uses named argument `precision$` by position + | -- this formatting argument uses named argument `precision` by position ... LL | precision = 2, - | ^^^^^^^^^ this named argument is only referred to by position in formatting string + | ^^^^^^^^^ this named argument is referred to by position in formatting string | help: use the named argument by name to avoid ambiguity | @@ -190,7 +190,7 @@ LL | "{}, Hello {1:2$.3$} {4:5$.6$}! {1}", | - this formatting argument uses named argument `f` by position ... LL | f = 0.02f32, - | ^ this named argument is only referred to by position in formatting string + | ^ this named argument is referred to by position in formatting string | help: use the named argument by name to avoid ambiguity | @@ -201,10 +201,10 @@ warning: named argument `width2` is not used by name --> $DIR/issue-99265.rs:58:9 | LL | "{}, Hello {1:2$.3$} {4:5$.6$}! {1}", - | -- this formatting argument uses named argument `width2$` by position + | -- this formatting argument uses named argument `width2` by position ... LL | width2 = 5, - | ^^^^^^ this named argument is only referred to by position in formatting string + | ^^^^^^ this named argument is referred to by position in formatting string | help: use the named argument by name to avoid ambiguity | @@ -215,10 +215,10 @@ warning: named argument `precision2` is not used by name --> $DIR/issue-99265.rs:60:9 | LL | "{}, Hello {1:2$.3$} {4:5$.6$}! {1}", - | -- this formatting argument uses named argument `precision2$` by position + | -- this formatting argument uses named argument `precision2` by position ... LL | precision2 = 2 - | ^^^^^^^^^^ this named argument is only referred to by position in formatting string + | ^^^^^^^^^^ this named argument is referred to by position in formatting string | help: use the named argument by name to avoid ambiguity | @@ -232,7 +232,7 @@ LL | "{}, Hello {1:2$.3$} {4:5$.6$}! {1}", | - this formatting argument uses named argument `g` by position ... LL | g = 0.02f32, - | ^ this named argument is only referred to by position in formatting string + | ^ this named argument is referred to by position in formatting string | help: use the named argument by name to avoid ambiguity | @@ -246,7 +246,7 @@ LL | "{}, Hello {1:2$.3$} {4:5$.6$}! {1}", | - this formatting argument uses named argument `f` by position ... LL | f = 0.02f32, - | ^ this named argument is only referred to by position in formatting string + | ^ this named argument is referred to by position in formatting string | help: use the named argument by name to avoid ambiguity | @@ -257,9 +257,9 @@ warning: named argument `f` is not used by name --> $DIR/issue-99265.rs:64:31 | LL | println!("Hello {:0.1}!", f = 0.02f32); - | - ^ this named argument is only referred to by position in formatting string - | | - | this formatting argument uses named argument `f` by position + | -- ^ this named argument is referred to by position in formatting string + | | + | this formatting argument uses named argument `f` by position | help: use the named argument by name to avoid ambiguity | @@ -270,7 +270,7 @@ warning: named argument `f` is not used by name --> $DIR/issue-99265.rs:68:32 | LL | println!("Hello {0:0.1}!", f = 0.02f32); - | - ^ this named argument is only referred to by position in formatting string + | - ^ this named argument is referred to by position in formatting string | | | this formatting argument uses named argument `f` by position | @@ -283,9 +283,9 @@ warning: named argument `v` is not used by name --> $DIR/issue-99265.rs:79:23 | LL | println!("{:0$}", v = val); - | -- ^ this named argument is only referred to by position in formatting string + | -- ^ this named argument is referred to by position in formatting string | | - | this formatting argument uses named argument `v$` by position + | this formatting argument uses named argument `v` by position | help: use the named argument by name to avoid ambiguity | @@ -296,9 +296,9 @@ warning: named argument `v` is not used by name --> $DIR/issue-99265.rs:79:23 | LL | println!("{:0$}", v = val); - | - ^ this named argument is only referred to by position in formatting string - | | - | this formatting argument uses named argument `v` by position + | -- ^ this named argument is referred to by position in formatting string + | | + | this formatting argument uses named argument `v` by position | help: use the named argument by name to avoid ambiguity | @@ -309,9 +309,9 @@ warning: named argument `v` is not used by name --> $DIR/issue-99265.rs:84:24 | LL | println!("{0:0$}", v = val); - | -- ^ this named argument is only referred to by position in formatting string + | -- ^ this named argument is referred to by position in formatting string | | - | this formatting argument uses named argument `v$` by position + | this formatting argument uses named argument `v` by position | help: use the named argument by name to avoid ambiguity | @@ -322,7 +322,7 @@ warning: named argument `v` is not used by name --> $DIR/issue-99265.rs:84:24 | LL | println!("{0:0$}", v = val); - | - ^ this named argument is only referred to by position in formatting string + | - ^ this named argument is referred to by position in formatting string | | | this formatting argument uses named argument `v` by position | @@ -335,9 +335,9 @@ warning: named argument `v` is not used by name --> $DIR/issue-99265.rs:89:26 | LL | println!("{:0$.0$}", v = val); - | -- ^ this named argument is only referred to by position in formatting string + | -- ^ this named argument is referred to by position in formatting string | | - | this formatting argument uses named argument `v$` by position + | this formatting argument uses named argument `v` by position | help: use the named argument by name to avoid ambiguity | @@ -348,9 +348,9 @@ warning: named argument `v` is not used by name --> $DIR/issue-99265.rs:89:26 | LL | println!("{:0$.0$}", v = val); - | -- ^ this named argument is only referred to by position in formatting string + | -- ^ this named argument is referred to by position in formatting string | | - | this formatting argument uses named argument `v$` by position + | this formatting argument uses named argument `v` by position | help: use the named argument by name to avoid ambiguity | @@ -361,9 +361,9 @@ warning: named argument `v` is not used by name --> $DIR/issue-99265.rs:89:26 | LL | println!("{:0$.0$}", v = val); - | - ^ this named argument is only referred to by position in formatting string - | | - | this formatting argument uses named argument `v` by position + | -- ^ this named argument is referred to by position in formatting string + | | + | this formatting argument uses named argument `v` by position | help: use the named argument by name to avoid ambiguity | @@ -374,9 +374,9 @@ warning: named argument `v` is not used by name --> $DIR/issue-99265.rs:96:27 | LL | println!("{0:0$.0$}", v = val); - | -- ^ this named argument is only referred to by position in formatting string + | -- ^ this named argument is referred to by position in formatting string | | - | this formatting argument uses named argument `v$` by position + | this formatting argument uses named argument `v` by position | help: use the named argument by name to avoid ambiguity | @@ -387,9 +387,9 @@ warning: named argument `v` is not used by name --> $DIR/issue-99265.rs:96:27 | LL | println!("{0:0$.0$}", v = val); - | -- ^ this named argument is only referred to by position in formatting string + | -- ^ this named argument is referred to by position in formatting string | | - | this formatting argument uses named argument `v$` by position + | this formatting argument uses named argument `v` by position | help: use the named argument by name to avoid ambiguity | @@ -400,7 +400,7 @@ warning: named argument `v` is not used by name --> $DIR/issue-99265.rs:96:27 | LL | println!("{0:0$.0$}", v = val); - | - ^ this named argument is only referred to by position in formatting string + | - ^ this named argument is referred to by position in formatting string | | | this formatting argument uses named argument `v` by position | @@ -413,9 +413,9 @@ warning: named argument `a` is not used by name --> $DIR/issue-99265.rs:104:28 | LL | println!("{} {a} {0}", a = 1); - | - ^ this named argument is only referred to by position in formatting string - | | - | this formatting argument uses named argument `a` by position + | -- ^ this named argument is referred to by position in formatting string + | | + | this formatting argument uses named argument `a` by position | help: use the named argument by name to avoid ambiguity | @@ -426,7 +426,7 @@ warning: named argument `a` is not used by name --> $DIR/issue-99265.rs:104:28 | LL | println!("{} {a} {0}", a = 1); - | - ^ this named argument is only referred to by position in formatting string + | - ^ this named argument is referred to by position in formatting string | | | this formatting argument uses named argument `a` by position | @@ -439,10 +439,10 @@ warning: named argument `b` is not used by name --> $DIR/issue-99265.rs:115:23 | LL | {:1$.2$}", - | -- this formatting argument uses named argument `b$` by position + | -- this formatting argument uses named argument `b` by position ... LL | a = 1.0, b = 1, c = 2, - | ^ this named argument is only referred to by position in formatting string + | ^ this named argument is referred to by position in formatting string | help: use the named argument by name to avoid ambiguity | @@ -453,10 +453,10 @@ warning: named argument `c` is not used by name --> $DIR/issue-99265.rs:115:30 | LL | {:1$.2$}", - | -- this formatting argument uses named argument `c$` by position + | -- this formatting argument uses named argument `c` by position ... LL | a = 1.0, b = 1, c = 2, - | ^ this named argument is only referred to by position in formatting string + | ^ this named argument is referred to by position in formatting string | help: use the named argument by name to avoid ambiguity | @@ -467,10 +467,10 @@ warning: named argument `a` is not used by name --> $DIR/issue-99265.rs:115:14 | LL | {:1$.2$}", - | - this formatting argument uses named argument `a` by position + | -- this formatting argument uses named argument `a` by position ... LL | a = 1.0, b = 1, c = 2, - | ^ this named argument is only referred to by position in formatting string + | ^ this named argument is referred to by position in formatting string | help: use the named argument by name to avoid ambiguity | @@ -481,10 +481,10 @@ warning: named argument `b` is not used by name --> $DIR/issue-99265.rs:126:23 | LL | {0:1$.2$}", - | -- this formatting argument uses named argument `b$` by position + | -- this formatting argument uses named argument `b` by position ... LL | a = 1.0, b = 1, c = 2, - | ^ this named argument is only referred to by position in formatting string + | ^ this named argument is referred to by position in formatting string | help: use the named argument by name to avoid ambiguity | @@ -495,10 +495,10 @@ warning: named argument `c` is not used by name --> $DIR/issue-99265.rs:126:30 | LL | {0:1$.2$}", - | -- this formatting argument uses named argument `c$` by position + | -- this formatting argument uses named argument `c` by position ... LL | a = 1.0, b = 1, c = 2, - | ^ this named argument is only referred to by position in formatting string + | ^ this named argument is referred to by position in formatting string | help: use the named argument by name to avoid ambiguity | @@ -512,7 +512,7 @@ LL | {0:1$.2$}", | - this formatting argument uses named argument `a` by position ... LL | a = 1.0, b = 1, c = 2, - | ^ this named argument is only referred to by position in formatting string + | ^ this named argument is referred to by position in formatting string | help: use the named argument by name to avoid ambiguity | @@ -523,9 +523,9 @@ warning: named argument `width` is not used by name --> $DIR/issue-99265.rs:132:39 | LL | println!("{{{:1$.2$}}}", x = 1.0, width = 3, precision = 2); - | -- ^^^^^ this named argument is only referred to by position in formatting string + | -- ^^^^^ this named argument is referred to by position in formatting string | | - | this formatting argument uses named argument `width$` by position + | this formatting argument uses named argument `width` by position | help: use the named argument by name to avoid ambiguity | @@ -536,9 +536,9 @@ warning: named argument `precision` is not used by name --> $DIR/issue-99265.rs:132:50 | LL | println!("{{{:1$.2$}}}", x = 1.0, width = 3, precision = 2); - | -- ^^^^^^^^^ this named argument is only referred to by position in formatting string + | -- ^^^^^^^^^ this named argument is referred to by position in formatting string | | - | this formatting argument uses named argument `precision$` by position + | this formatting argument uses named argument `precision` by position | help: use the named argument by name to avoid ambiguity | @@ -549,9 +549,9 @@ warning: named argument `x` is not used by name --> $DIR/issue-99265.rs:132:30 | LL | println!("{{{:1$.2$}}}", x = 1.0, width = 3, precision = 2); - | - ^ this named argument is only referred to by position in formatting string - | | - | this formatting argument uses named argument `x` by position + | -- ^ this named argument is referred to by position in formatting string + | | + | this formatting argument uses named argument `x` by position | help: use the named argument by name to avoid ambiguity | diff --git a/src/test/ui/macros/issue-99907.fixed b/src/test/ui/macros/issue-99907.fixed new file mode 100644 index 00000000000..9e0e1b80ee5 --- /dev/null +++ b/src/test/ui/macros/issue-99907.fixed @@ -0,0 +1,24 @@ +// check-pass +// run-rustfix + +fn main() { + println!("Hello {f:.1}!", f = 0.02f32); + //~^ WARNING named argument `f` is not used by name [named_arguments_used_positionally] + //~| HELP use the named argument by name to avoid ambiguity + + println!("Hello {f:1.1}!", f = 0.02f32); + //~^ WARNING named argument `f` is not used by name [named_arguments_used_positionally] + //~| HELP use the named argument by name to avoid ambiguity + + println!("Hello {f}!", f = 0.02f32); + //~^ WARNING named argument `f` is not used by name [named_arguments_used_positionally] + //~| HELP use the named argument by name to avoid ambiguity + + println!("Hello {f}!", f = 0.02f32); + //~^ WARNING named argument `f` is not used by name [named_arguments_used_positionally] + //~| HELP use the named argument by name to avoid ambiguity + + println!("Hello {f}!", f = 0.02f32); + //~^ WARNING named argument `f` is not used by name [named_arguments_used_positionally] + //~| HELP use the named argument by name to avoid ambiguity +} diff --git a/src/test/ui/macros/issue-99907.rs b/src/test/ui/macros/issue-99907.rs new file mode 100644 index 00000000000..eebcfc2efec --- /dev/null +++ b/src/test/ui/macros/issue-99907.rs @@ -0,0 +1,24 @@ +// check-pass +// run-rustfix + +fn main() { + println!("Hello {:.1}!", f = 0.02f32); + //~^ WARNING named argument `f` is not used by name [named_arguments_used_positionally] + //~| HELP use the named argument by name to avoid ambiguity + + println!("Hello {:1.1}!", f = 0.02f32); + //~^ WARNING named argument `f` is not used by name [named_arguments_used_positionally] + //~| HELP use the named argument by name to avoid ambiguity + + println!("Hello {}!", f = 0.02f32); + //~^ WARNING named argument `f` is not used by name [named_arguments_used_positionally] + //~| HELP use the named argument by name to avoid ambiguity + + println!("Hello { }!", f = 0.02f32); + //~^ WARNING named argument `f` is not used by name [named_arguments_used_positionally] + //~| HELP use the named argument by name to avoid ambiguity + + println!("Hello { }!", f = 0.02f32); + //~^ WARNING named argument `f` is not used by name [named_arguments_used_positionally] + //~| HELP use the named argument by name to avoid ambiguity +} diff --git a/src/test/ui/macros/issue-99907.stderr b/src/test/ui/macros/issue-99907.stderr new file mode 100644 index 00000000000..4786ce003b4 --- /dev/null +++ b/src/test/ui/macros/issue-99907.stderr @@ -0,0 +1,68 @@ +warning: named argument `f` is not used by name + --> $DIR/issue-99907.rs:5:30 + | +LL | println!("Hello {:.1}!", f = 0.02f32); + | -- ^ this named argument is referred to by position in formatting string + | | + | this formatting argument uses named argument `f` by position + | + = note: `#[warn(named_arguments_used_positionally)]` on by default +help: use the named argument by name to avoid ambiguity + | +LL | println!("Hello {f:.1}!", f = 0.02f32); + | + + +warning: named argument `f` is not used by name + --> $DIR/issue-99907.rs:9:31 + | +LL | println!("Hello {:1.1}!", f = 0.02f32); + | -- ^ this named argument is referred to by position in formatting string + | | + | this formatting argument uses named argument `f` by position + | +help: use the named argument by name to avoid ambiguity + | +LL | println!("Hello {f:1.1}!", f = 0.02f32); + | + + +warning: named argument `f` is not used by name + --> $DIR/issue-99907.rs:13:27 + | +LL | println!("Hello {}!", f = 0.02f32); + | -- ^ this named argument is referred to by position in formatting string + | | + | this formatting argument uses named argument `f` by position + | +help: use the named argument by name to avoid ambiguity + | +LL | println!("Hello {f}!", f = 0.02f32); + | + + +warning: named argument `f` is not used by name + --> $DIR/issue-99907.rs:17:28 + | +LL | println!("Hello { }!", f = 0.02f32); + | --- ^ this named argument is referred to by position in formatting string + | | + | this formatting argument uses named argument `f` by position + | +help: use the named argument by name to avoid ambiguity + | +LL | println!("Hello {f}!", f = 0.02f32); + | + + +warning: named argument `f` is not used by name + --> $DIR/issue-99907.rs:21:29 + | +LL | println!("Hello { }!", f = 0.02f32); + | ---- ^ this named argument is referred to by position in formatting string + | | + | this formatting argument uses named argument `f` by position + | +help: use the named argument by name to avoid ambiguity + | +LL | println!("Hello {f}!", f = 0.02f32); + | + + +warning: 5 warnings emitted + |
