1
Fork 0

Rollup merge of #108363 - cjgillot:unused-crate, r=WaffleLapkin

Move the unused extern crate check back to the resolver.

It doesn't have anything to do in `rustc_hir_typeck`.
This commit is contained in:
Matthias Krüger 2023-02-27 18:48:49 +01:00 committed by GitHub
commit 660f184966
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 186 additions and 196 deletions

View file

@ -893,6 +893,23 @@ pub trait LintContext: Sized {
BuiltinLintDiagnostics::ByteSliceInPackedStructWithDerive => {
db.help("consider implementing the trait by hand, or remove the `packed` attribute");
}
BuiltinLintDiagnostics::UnusedExternCrate { removal_span }=> {
db.span_suggestion(
removal_span,
"remove it",
"",
Applicability::MachineApplicable,
);
}
BuiltinLintDiagnostics::ExternCrateNotIdiomatic { vis_span, ident_span }=> {
let suggestion_span = vis_span.between(ident_span);
db.span_suggestion_verbose(
suggestion_span,
"convert it to a `use`",
if vis_span.is_empty() { "use " } else { " use " },
Applicability::MachineApplicable,
);
}
}
// Rewrap `db`, and pass control to the user.
decorate(db)