diff options
| author | Yotam Ofek <yotam.ofek@gmail.com> | 2025-06-18 10:28:32 +0000 |
|---|---|---|
| committer | Yotam Ofek <yotam.ofek@gmail.com> | 2025-06-19 10:26:13 +0000 |
| commit | 2bf66e3887f8ef915a1f92496b1ddf27d847b1ee (patch) | |
| tree | 02acead24ec57624f83151c32eb5c3e262f5dfb0 /src/librustdoc/html | |
| parent | 569aa26e7bf7f3742fbd6ab3ea3e3c5f9b8d8a75 (diff) | |
| download | rust-2bf66e3887f8ef915a1f92496b1ddf27d847b1ee.tar.gz rust-2bf66e3887f8ef915a1f92496b1ddf27d847b1ee.zip | |
`Option`s are `Iterator`s
Diffstat (limited to 'src/librustdoc/html')
| -rw-r--r-- | src/librustdoc/html/render/write_shared.rs | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/librustdoc/html/render/write_shared.rs b/src/librustdoc/html/render/write_shared.rs index fc8111fffdc..606a9113908 100644 --- a/src/librustdoc/html/render/write_shared.rs +++ b/src/librustdoc/html/render/write_shared.rs @@ -866,9 +866,8 @@ impl<'item> DocVisitor<'item> for TypeImplCollector<'_, '_, 'item> { let impl_ = cache .impls .get(&target_did) - .map(|v| &v[..]) - .unwrap_or_default() - .iter() + .into_iter() + .flatten() .map(|impl_| { (impl_.impl_item.item_id, AliasedTypeImpl { impl_, type_aliases: Vec::new() }) }) @@ -883,14 +882,8 @@ impl<'item> DocVisitor<'item> for TypeImplCollector<'_, '_, 'item> { // Exclude impls that are directly on this type. They're already in the HTML. // Some inlining scenarios can cause there to be two versions of the same // impl: one on the type alias and one on the underlying target type. - let mut seen_impls: FxHashSet<ItemId> = cache - .impls - .get(&self_did) - .map(|s| &s[..]) - .unwrap_or_default() - .iter() - .map(|i| i.impl_item.item_id) - .collect(); + let mut seen_impls: FxHashSet<ItemId> = + cache.impls.get(&self_did).into_iter().flatten().map(|i| i.impl_item.item_id).collect(); for (impl_item_id, aliased_type_impl) in &mut aliased_type.impl_ { // Only include this impl if it actually unifies with this alias. // Synthetic impls are not included; those are also included in the HTML. |
