Skip to content

Commit

Permalink
Tweak duplicate fmt arg error
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Nov 25, 2019
1 parent 9c97d73 commit 1eeed17
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/libsyntax_ext/format.rs
Expand Up @@ -172,7 +172,8 @@ fn parse_args<'a>(
let e = p.parse_expr()?;
if let Some(prev) = names.get(&name) {
ecx.struct_span_err(e.span, &format!("duplicate argument named `{}`", name))
.span_note(args[*prev].span, "previously here")
.span_label(args[*prev].span, "previously here")
.span_label(e.span, "duplicate argument")
.emit();
continue;
}
Expand Down
10 changes: 3 additions & 7 deletions src/test/ui/if/ifmt-bad-arg.stderr
Expand Up @@ -138,13 +138,9 @@ error: duplicate argument named `foo`
--> $DIR/ifmt-bad-arg.rs:40:33
|
LL | format!("{foo}", foo=1, foo=2);
| ^
|
note: previously here
--> $DIR/ifmt-bad-arg.rs:40:26
|
LL | format!("{foo}", foo=1, foo=2);
| ^
| - ^ duplicate argument
| |
| previously here

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

0 comments on commit 1eeed17

Please sign in to comment.