Skip to content

Commit aa76a59

Browse files
committed
Revert "rustdoc: filter before storing in vec"
This reverts commit c79b960.
1 parent ade7ecf commit aa76a59

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/librustdoc/html/render/context.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -160,15 +160,8 @@ impl SharedContext<'_> {
160160
) -> Vec<&'a formats::Impl> {
161161
let tcx = self.tcx;
162162
let cache = &self.cache;
163-
let mut saw_impls = FxHashSet::default();
164-
let mut v: Vec<&formats::Impl> = cache
165-
.impls
166-
.get(&did)
167-
.map(Vec::as_slice)
168-
.unwrap_or(&[])
169-
.iter()
170-
.filter(|i| saw_impls.insert(i.def_id()))
171-
.collect();
163+
let mut v: Vec<&formats::Impl> =
164+
cache.impls.get(&did).map(Vec::as_slice).unwrap_or(&[]).iter().collect();
172165
if let TypeAliasItem(ait) = &*it.kind &&
173166
let aliased_clean_type = ait.item_type.as_ref().unwrap_or(&ait.type_) &&
174167
let Some(aliased_type_defid) = aliased_clean_type.def_id(cache) &&
@@ -189,12 +182,13 @@ impl SharedContext<'_> {
189182
v.extend(av.iter().filter(|impl_| {
190183
if let Some(impl_def_id) = impl_.impl_item.item_id.as_def_id() {
191184
reject_cx.types_may_unify(aliased_ty, tcx.type_of(impl_def_id).skip_binder())
192-
&& saw_impls.insert(impl_def_id)
193185
} else {
194186
false
195187
}
196188
}));
197189
}
190+
let mut saw_impls = FxHashSet::default();
191+
v.retain(|i| saw_impls.insert(i.def_id()));
198192
v
199193
}
200194
}

0 commit comments

Comments
 (0)