Skip to content

Commit 4da4f27

Browse files
committed
Unquerify maybe_unused_trait_imports.
1 parent 9490320 commit 4da4f27

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
@@ -23,7 +23,7 @@ fn check_unused_traits(tcx: TyCtxt<'_>, (): ()) {
2323
used_trait_imports.extend_unord(imports.items().copied());
2424
}
2525

26-
for &id in tcx.maybe_unused_trait_imports(()) {
26+
for &id in tcx.resolutions(()).maybe_unused_trait_imports.iter() {
2727
debug_assert_eq!(tcx.def_kind(id), DefKind::Use);
2828
if tcx.visibility(id).is_public() {
2929
continue;

compiler/rustc_middle/src/query/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2261,9 +2261,6 @@ rustc_queries! {
22612261
query upvars_mentioned(def_id: DefId) -> Option<&'tcx FxIndexMap<hir::HirId, hir::Upvar>> {
22622262
desc { |tcx| "collecting upvars mentioned in `{}`", tcx.def_path_str(def_id) }
22632263
}
2264-
query maybe_unused_trait_imports(_: ()) -> &'tcx FxIndexSet<LocalDefId> {
2265-
desc { "fetching potentially unused trait imports" }
2266-
}
22672264
query names_imported_by_glob_use(def_id: LocalDefId) -> &'tcx FxIndexSet<Symbol> {
22682265
desc { |tcx| "finding names imported by glob use for `{}`", tcx.def_path_str(def_id) }
22692266
}

compiler/rustc_middle/src/ty/context.rs

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

34133413
pub fn provide(providers: &mut Providers) {
3414-
providers.maybe_unused_trait_imports =
3415-
|tcx, ()| &tcx.resolutions(()).maybe_unused_trait_imports;
34163414
providers.names_imported_by_glob_use = |tcx, id| {
34173415
tcx.arena.alloc(tcx.resolutions(()).glob_map.get(&id).cloned().unwrap_or_default())
34183416
};

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)