Be more specific when flagging imports that are redundant due to the extern prelude

This commit is contained in:
León Orell Valerian Liehr 2024-03-23 17:30:44 +01:00
parent 5dbaafdb93
commit 8a24ddf64b
No known key found for this signature in database
GPG key ID: D17A07215F68E713
9 changed files with 108 additions and 13 deletions

View file

@ -105,7 +105,7 @@ pub(super) fn builtin(sess: &Session, diagnostic: BuiltinLintDiag, diag: &mut Di
BuiltinLintDiag::RedundantImport(spans, ident) => {
for (span, is_imported) in spans {
let introduced = if is_imported { "imported" } else { "defined" };
let span_msg = if span.is_dummy() { "by prelude" } else { "here" };
let span_msg = if span.is_dummy() { "by the extern prelude" } else { "here" };
diag.span_label(
span,
format!("the item `{ident}` is already {introduced} {span_msg}"),