Skip to content
Permalink
Browse files

Tweak duplicate fmt arg error

  • Loading branch information
estebank committed Nov 25, 2019
1 parent 9c97d73 commit 1eeed17c9ebc5a5bcae5613cdef77a0fa17828aa
Showing with 5 additions and 8 deletions.
  1. +2 −1 src/libsyntax_ext/format.rs
  2. +3 −7 src/test/ui/if/ifmt-bad-arg.stderr
@@ -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;
}
@@ -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

0 comments on commit 1eeed17

Please sign in to comment.
You can’t perform that action at this time.