Skip to content

Commit 1eeed17

Browse files
committed
Tweak duplicate fmt arg error
1 parent 9c97d73 commit 1eeed17

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/libsyntax_ext/format.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@ fn parse_args<'a>(
172172
let e = p.parse_expr()?;
173173
if let Some(prev) = names.get(&name) {
174174
ecx.struct_span_err(e.span, &format!("duplicate argument named `{}`", name))
175-
.span_note(args[*prev].span, "previously here")
175+
.span_label(args[*prev].span, "previously here")
176+
.span_label(e.span, "duplicate argument")
176177
.emit();
177178
continue;
178179
}

src/test/ui/if/ifmt-bad-arg.stderr

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,9 @@ error: duplicate argument named `foo`
138138
--> $DIR/ifmt-bad-arg.rs:40:33
139139
|
140140
LL | format!("{foo}", foo=1, foo=2);
141-
| ^
142-
|
143-
note: previously here
144-
--> $DIR/ifmt-bad-arg.rs:40:26
145-
|
146-
LL | format!("{foo}", foo=1, foo=2);
147-
| ^
141+
| - ^ duplicate argument
142+
| |
143+
| previously here
148144

149145
error: positional arguments cannot follow named arguments
150146
--> $DIR/ifmt-bad-arg.rs:41:35

0 commit comments

Comments
 (0)