Tweak duplicate fmt arg error
This commit is contained in:
parent
9c97d73a2d
commit
1eeed17c9e
2 changed files with 5 additions and 8 deletions
|
@ -172,7 +172,8 @@ fn parse_args<'a>(
|
||||||
let e = p.parse_expr()?;
|
let e = p.parse_expr()?;
|
||||||
if let Some(prev) = names.get(&name) {
|
if let Some(prev) = names.get(&name) {
|
||||||
ecx.struct_span_err(e.span, &format!("duplicate argument named `{}`", 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();
|
.emit();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,13 +138,9 @@ error: duplicate argument named `foo`
|
||||||
--> $DIR/ifmt-bad-arg.rs:40:33
|
--> $DIR/ifmt-bad-arg.rs:40:33
|
||||||
|
|
|
|
||||||
LL | format!("{foo}", foo=1, foo=2);
|
LL | format!("{foo}", foo=1, foo=2);
|
||||||
| ^
|
| - ^ duplicate argument
|
||||||
|
|
| |
|
||||||
note: previously here
|
| previously here
|
||||||
--> $DIR/ifmt-bad-arg.rs:40:26
|
|
||||||
|
|
|
||||||
LL | format!("{foo}", foo=1, foo=2);
|
|
||||||
| ^
|
|
||||||
|
|
||||||
error: positional arguments cannot follow named arguments
|
error: positional arguments cannot follow named arguments
|
||||||
--> $DIR/ifmt-bad-arg.rs:41:35
|
--> $DIR/ifmt-bad-arg.rs:41:35
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue