Add machine-applicable suggestion for unused_qualifications lint

This commit is contained in:
许杰友 Jieyou Xu (Joe) 2023-06-17 15:06:48 +08:00
parent 33a2c2487a
commit 0b5c683b06
No known key found for this signature in database
GPG key ID: 94F68FD0E4899BB0
7 changed files with 98 additions and 1 deletions

View file

@ -956,6 +956,14 @@ pub trait LintContext: Sized {
db.span_note(glob_reexport_span, format!("the name `{}` in the {} namespace is supposed to be publicly re-exported here", name, namespace));
db.span_note(private_item_span, "but the private item here shadows it".to_owned());
}
BuiltinLintDiagnostics::UnusedQualifications { path_span, unqualified_path } => {
db.span_suggestion_verbose(
path_span,
"replace it with the unqualified path",
unqualified_path,
Applicability::MachineApplicable
);
}
}
// Rewrap `db`, and pass control to the user.
decorate(db)