Skip to content

Commit 7825ecd

Browse files
committed
Options are Iterators
1 parent 480eb77 commit 7825ecd

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/librustdoc/html/render/write_shared.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -866,9 +866,8 @@ impl<'item> DocVisitor<'item> for TypeImplCollector<'_, '_, 'item> {
866866
let impl_ = cache
867867
.impls
868868
.get(&target_did)
869-
.map(|v| &v[..])
870-
.unwrap_or_default()
871-
.iter()
869+
.into_iter()
870+
.flatten()
872871
.map(|impl_| {
873872
(impl_.impl_item.item_id, AliasedTypeImpl { impl_, type_aliases: Vec::new() })
874873
})
@@ -883,14 +882,8 @@ impl<'item> DocVisitor<'item> for TypeImplCollector<'_, '_, 'item> {
883882
// Exclude impls that are directly on this type. They're already in the HTML.
884883
// Some inlining scenarios can cause there to be two versions of the same
885884
// impl: one on the type alias and one on the underlying target type.
886-
let mut seen_impls: FxHashSet<ItemId> = cache
887-
.impls
888-
.get(&self_did)
889-
.map(|s| &s[..])
890-
.unwrap_or_default()
891-
.iter()
892-
.map(|i| i.impl_item.item_id)
893-
.collect();
885+
let mut seen_impls: FxHashSet<ItemId> =
886+
cache.impls.get(&self_did).into_iter().flatten().map(|i| i.impl_item.item_id).collect();
894887
for (impl_item_id, aliased_type_impl) in &mut aliased_type.impl_ {
895888
// Only include this impl if it actually unifies with this alias.
896889
// Synthetic impls are not included; those are also included in the HTML.

0 commit comments

Comments
 (0)