Skip to content

Commit 9549077

Browse files
committed
Remove a function that has no necessary callers
1 parent 48bd2ed commit 9549077

File tree

2 files changed

+2
-17
lines changed

2 files changed

+2
-17
lines changed

compiler/rustc_middle/src/ty/trait_def.rs

-15
Original file line numberDiff line numberDiff line change
@@ -129,21 +129,6 @@ impl<'tcx> TraitDef {
129129
}
130130

131131
impl<'tcx> TyCtxt<'tcx> {
132-
/// `trait_def_id` MUST BE the `DefId` of a trait.
133-
pub fn for_each_impl<F: FnMut(DefId)>(self, trait_def_id: DefId, mut f: F) {
134-
let impls = self.trait_impls_of(trait_def_id);
135-
136-
for &impl_def_id in impls.blanket_impls.iter() {
137-
f(impl_def_id);
138-
}
139-
140-
for v in impls.non_blanket_impls.values() {
141-
for &impl_def_id in v {
142-
f(impl_def_id);
143-
}
144-
}
145-
}
146-
147132
/// Iterate over every impl that could possibly match the self type `self_ty`.
148133
///
149134
/// `trait_def_id` MUST BE the `DefId` of a trait.

src/tools/clippy/clippy_lints/src/new_without_default.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,14 @@ impl<'tcx> LateLintPass<'tcx> for NewWithoutDefault {
9797
{
9898
if self.impling_types.is_none() {
9999
let mut impls = HirIdSet::default();
100-
cx.tcx.for_each_impl(default_trait_id, |d| {
100+
for &d in cx.tcx.local_trait_impls(default_trait_id) {
101101
let ty = cx.tcx.type_of(d).instantiate_identity();
102102
if let Some(ty_def) = ty.ty_adt_def() {
103103
if let Some(local_def_id) = ty_def.did().as_local() {
104104
impls.insert(cx.tcx.local_def_id_to_hir_id(local_def_id));
105105
}
106106
}
107-
});
107+
}
108108
self.impling_types = Some(impls);
109109
}
110110

0 commit comments

Comments
 (0)