Rollup merge of #112729 - jieyouxu:unused-qualifications-suggestion, r=b-naber
Add machine-applicable suggestion for `unused_qualifications` lint ``` error: unnecessary qualification --> $DIR/unused-qualifications-suggestion.rs:17:5 | LL | foo::bar(); | ^^^^^^^^ | note: the lint level is defined here --> $DIR/unused-qualifications-suggestion.rs:3:9 | LL | #![deny(unused_qualifications)] | ^^^^^^^^^^^^^^^^^^^^^ help: replace it with the unqualified path | LL | bar(); | ~~~ ``` Closes #92198.
This commit is contained in:
commit
2cc04536b4
7 changed files with 98 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue