From fd4c6e903b0161cedb2297e2de25783842dffe2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Thu, 11 Apr 2019 16:15:48 -0700 Subject: [PATCH] Remove duplicated redundant spans --- src/librustc_resolve/resolve_imports.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index 97b630ba5f298..2c98c66c62e37 100644 --- a/src/librustc_resolve/resolve_imports.rs +++ b/src/librustc_resolve/resolve_imports.rs @@ -1310,15 +1310,14 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> { if !is_redundant.is_empty() && is_redundant.present_items().all(|is_redundant| is_redundant) { + let mut redundant_spans: Vec<_> = redundant_span.present_items().collect(); + redundant_spans.dedup(); self.session.buffer_lint_with_diagnostic( UNUSED_IMPORTS, directive.id, directive.span, &format!("the item `{}` is imported redundantly", ident), - BuiltinLintDiagnostics::RedundantImport( - redundant_span.present_items().collect(), - ident, - ), + BuiltinLintDiagnostics::RedundantImport(redundant_spans, ident), ); } }