UnknownCrateTypes(Span, String, String),
UnusedImports(String, Vec<(Span, String)>),
NestedImplTrait { outer_impl_trait_span: Span, inner_impl_trait_span: Span },
- RedundantImport(Vec<Span>, ast::Ident),
+ RedundantImport(Vec<(Span, bool)>, ast::Ident),
}
impl BuiltinLintDiagnostics {
db.span_label(inner_impl_trait_span, "nested `impl Trait` here");
}
BuiltinLintDiagnostics::RedundantImport(spans, ident) => {
- for span in spans {
+ for (span, is_imported) in spans {
+ let introduced = if is_imported { "imported" } else { "defined" };
db.span_label(
span,
- format!("the item `{}` was already imported here", ident)
+ format!("the item `{}` was {} here", ident, introduced)
);
}
}
) {
Ok(other_binding) => {
is_redundant[ns] = Some(binding.def() == other_binding.def());
- redundant_span[ns] = Some(other_binding.span);
+ redundant_span[ns] =
+ Some((other_binding.span, other_binding.is_import()));
}
Err(_) => is_redundant[ns] = Some(false)
}
--> $DIR/use-redundant.rs:14:9
|
LL | use crate::foo::Bar;
- | --------------- the item `Bar` was already imported here
+ | --------------- the item `Bar` was imported here
...
LL | use crate::foo::Bar;
| ^^^^^^^^^^^^^^^