diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2019-04-11 16:15:48 -0700 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2019-04-11 16:15:48 -0700 |
| commit | fd4c6e903b0161cedb2297e2de25783842dffe2b (patch) | |
| tree | 0933bc238c39bc476ad3ea65c827a9070815f2d1 | |
| parent | 96d700f1b7bc9c53fa0d11567adb1ed2c1c27e79 (diff) | |
| download | rust-fd4c6e903b0161cedb2297e2de25783842dffe2b.tar.gz rust-fd4c6e903b0161cedb2297e2de25783842dffe2b.zip | |
Remove duplicated redundant spans
| -rw-r--r-- | src/librustc_resolve/resolve_imports.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index 97b630ba5f2..2c98c66c62e 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), ); } } |
