Skip to content

Commit a8ad7eb

Browse files
committed
Revert "rustdoc: filter before storing in vec"
This reverts commit c79b960.
1 parent 2a291ce commit a8ad7eb

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
@@ -159,15 +159,8 @@ impl SharedContext<'_> {
159159
) -> Vec<&'a formats::Impl> {
160160
let tcx = self.tcx;
161161
let cache = &self.cache;
162-
let mut saw_impls = FxHashSet::default();
163-
let mut v: Vec<&formats::Impl> = cache
164-
.impls
165-
.get(&did)
166-
.map(Vec::as_slice)
167-
.unwrap_or(&[])
168-
.iter()
169-
.filter(|i| saw_impls.insert(i.def_id()))
170-
.collect();
162+
let mut v: Vec<&formats::Impl> =
163+
cache.impls.get(&did).map(Vec::as_slice).unwrap_or(&[]).iter().collect();
171164
if let TypeAliasItem(ait) = &*it.kind &&
172165
let aliased_clean_type = ait.item_type.as_ref().unwrap_or(&ait.type_) &&
173166
let Some(aliased_type_defid) = aliased_clean_type.def_id(cache) &&
@@ -188,12 +181,13 @@ impl SharedContext<'_> {
188181
v.extend(av.iter().filter(|impl_| {
189182
if let Some(impl_def_id) = impl_.impl_item.item_id.as_def_id() {
190183
reject_cx.types_may_unify(aliased_ty, tcx.type_of(impl_def_id).skip_binder())
191-
&& saw_impls.insert(impl_def_id)
192184
} else {
193185
false
194186
}
195187
}));
196188
}
189+
let mut saw_impls = FxHashSet::default();
190+
v.retain(|i| saw_impls.insert(i.def_id()));
197191
v
198192
}
199193
}

0 commit comments

Comments
 (0)