summaryrefslogtreecommitdiffstats
path: root/src/librustdoc/formats/cache.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/librustdoc/formats/cache.rs')
-rw-r--r--src/librustdoc/formats/cache.rs36
1 files changed, 21 insertions, 15 deletions
diff --git a/src/librustdoc/formats/cache.rs b/src/librustdoc/formats/cache.rs
index abff77253..9802097ea 100644
--- a/src/librustdoc/formats/cache.rs
+++ b/src/librustdoc/formats/cache.rs
@@ -230,14 +230,14 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> {
// If the impl is from a masked crate or references something from a
// masked crate then remove it completely.
- if let clean::ImplItem(ref i) = *item.kind &&
- (self.cache.masked_crates.contains(&item.item_id.krate())
+ if let clean::ImplItem(ref i) = *item.kind
+ && (self.cache.masked_crates.contains(&item.item_id.krate())
|| i.trait_
.as_ref()
- .map_or(false, |t| is_from_private_dep(self.tcx, self.cache, t.def_id()))
+ .is_some_and(|t| is_from_private_dep(self.tcx, self.cache, t.def_id()))
|| i.for_
.def_id(self.cache)
- .map_or(false, |d| is_from_private_dep(self.tcx, self.cache, d)))
+ .is_some_and(|d| is_from_private_dep(self.tcx, self.cache, d)))
{
return None;
}
@@ -249,9 +249,9 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> {
}
// Collect all the implementors of traits.
- if let clean::ImplItem(ref i) = *item.kind &&
- let Some(trait_) = &i.trait_ &&
- !i.kind.is_blanket()
+ if let clean::ImplItem(ref i) = *item.kind
+ && let Some(trait_) = &i.trait_
+ && !i.kind.is_blanket()
{
self.cache
.implementors
@@ -264,8 +264,9 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> {
if let Some(s) = item.name.or_else(|| {
if item.is_stripped() {
None
- } else if let clean::ImportItem(ref i) = *item.kind &&
- let clean::ImportKind::Simple(s) = i.kind {
+ } else if let clean::ImportItem(ref i) = *item.kind
+ && let clean::ImportKind::Simple(s) = i.kind
+ {
Some(s)
} else {
None
@@ -278,7 +279,7 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> {
.cache
.parent_stack
.last()
- .map_or(false, |parent| parent.is_trait_impl()) =>
+ .is_some_and(|parent| parent.is_trait_impl()) =>
{
// skip associated items in trait impls
((None, None), false)
@@ -340,7 +341,7 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> {
// A crate has a module at its root, containing all items,
// which should not be indexed. The crate-item itself is
// inserted later on when serializing the search-index.
- if item.item_id.as_def_id().map_or(false, |idx| !idx.is_crate_root())
+ if item.item_id.as_def_id().is_some_and(|idx| !idx.is_crate_root())
&& let ty = item.type_()
&& (ty != ItemType::StructField
|| u16::from_str_radix(s.as_str(), 10).is_err())
@@ -357,7 +358,9 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> {
desc,
parent,
parent_idx: None,
- impl_id: if let Some(ParentStackItem::Impl { item_id, .. }) = self.cache.parent_stack.last() {
+ impl_id: if let Some(ParentStackItem::Impl { item_id, .. }) =
+ self.cache.parent_stack.last()
+ {
item_id.as_def_id()
} else {
None
@@ -366,6 +369,7 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> {
&item,
self.tcx,
clean_impl_generics(self.cache.parent_stack.last()).as_ref(),
+ parent,
self.cache,
),
aliases: item.attrs.get_doc_aliases(),
@@ -493,9 +497,11 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> {
clean::Type::Path { ref path }
| clean::BorrowedRef { type_: box clean::Type::Path { ref path }, .. } => {
dids.insert(path.def_id());
- if let Some(generics) = path.generics() &&
- let ty::Adt(adt, _) = self.tcx.type_of(path.def_id()).instantiate_identity().kind() &&
- adt.is_fundamental() {
+ if let Some(generics) = path.generics()
+ && let ty::Adt(adt, _) =
+ self.tcx.type_of(path.def_id()).instantiate_identity().kind()
+ && adt.is_fundamental()
+ {
for ty in generics {
if let Some(did) = ty.def_id(self.cache) {
dids.insert(did);