From 1eeed17c9ebc5a5bcae5613cdef77a0fa17828aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Mon, 25 Nov 2019 12:34:16 -0800 Subject: [PATCH] Tweak duplicate fmt arg error --- src/libsyntax_ext/format.rs | 3 ++- src/test/ui/if/ifmt-bad-arg.stderr | 10 +++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/libsyntax_ext/format.rs b/src/libsyntax_ext/format.rs index 25daca9237f..0a19d64200c 100644 --- a/src/libsyntax_ext/format.rs +++ b/src/libsyntax_ext/format.rs @@ -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; } diff --git a/src/test/ui/if/ifmt-bad-arg.stderr b/src/test/ui/if/ifmt-bad-arg.stderr index 07917c2a540..c024094dd56 100644 --- a/src/test/ui/if/ifmt-bad-arg.stderr +++ b/src/test/ui/if/ifmt-bad-arg.stderr @@ -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