Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b934f1a

Browse files
Rollup merge of #143373 - cjgillot:bare-unused-trait-imports, r=petrochenkov
Unquerify maybe_unused_trait_imports. Based on #143247 r? ```@ghost``` for perf
2 parents 73305e2 + 258e410 commit b934f1a

File tree

4 files changed

+2
-7
lines changed

4 files changed

+2
-7
lines changed

‎compiler/rustc_hir_analysis/src/check_unused.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub(super) fn check_unused_traits(tcx: TyCtxt<'_>, (): ()) {
1818
used_trait_imports.extend_unord(imports.items().copied());
1919
}
2020

21-
for &id in tcx.maybe_unused_trait_imports(()) {
21+
for &id in tcx.resolutions(()).maybe_unused_trait_imports.iter() {
2222
debug_assert_eq!(tcx.def_kind(id), DefKind::Use);
2323
if tcx.visibility(id).is_public() {
2424
continue;

‎compiler/rustc_middle/src/query/mod.rs‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2285,9 +2285,6 @@ rustc_queries! {
22852285
query upvars_mentioned(def_id: DefId) -> Option<&'tcx FxIndexMap<hir::HirId, hir::Upvar>> {
22862286
desc { |tcx| "collecting upvars mentioned in `{}`", tcx.def_path_str(def_id) }
22872287
}
2288-
query maybe_unused_trait_imports(_: ()) -> &'tcx FxIndexSet<LocalDefId> {
2289-
desc { "fetching potentially unused trait imports" }
2290-
}
22912288

22922289
/// All available crates in the graph, including those that should not be user-facing
22932290
/// (such as private crates).

‎compiler/rustc_middle/src/ty/context.rs‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3428,8 +3428,6 @@ pub struct DeducedParamAttrs {
34283428
}
34293429

34303430
pub fn provide(providers: &mut Providers) {
3431-
providers.maybe_unused_trait_imports =
3432-
|tcx, ()| &tcx.resolutions(()).maybe_unused_trait_imports;
34333431
providers.extern_mod_stmt_cnum =
34343432
|tcx, id| tcx.resolutions(()).extern_crate_map.get(&id).cloned();
34353433
providers.is_panic_runtime =

‎src/tools/clippy/clippy_lints/src/unused_trait_names.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedTraitNames {
6565
&& ident.name != kw::Underscore
6666
// Only check traits
6767
&& let Some(Res::Def(DefKind::Trait, _)) = path.res.type_ns
68-
&& cx.tcx.maybe_unused_trait_imports(()).contains(&item.owner_id.def_id)
68+
&& cx.tcx.resolutions(()).maybe_unused_trait_imports.contains(&item.owner_id.def_id)
6969
// Only check this import if it is visible to its module only (no pub, pub(crate), ...)
7070
&& let module = cx.tcx.parent_module_from_def_id(item.owner_id.def_id)
7171
&& cx.tcx.visibility(item.owner_id.def_id) == Visibility::Restricted(module.to_def_id())

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /