diff options
| author | Michael Howell <michael@notriddle.com> | 2024-08-30 10:52:45 -0700 |
|---|---|---|
| committer | Michael Howell <michael@notriddle.com> | 2024-09-07 21:06:50 -0700 |
| commit | 65903362ad810c572e8ae742f6ed5ae3548238e4 (patch) | |
| tree | a7658890f8165abdda135c92045ccdb77612a720 /src/librustdoc/json | |
| parent | e80c9ac3e213c0c2e6d1a80ea2d4bf074ff8f887 (diff) | |
| download | rust-65903362ad810c572e8ae742f6ed5ae3548238e4.tar.gz rust-65903362ad810c572e8ae742f6ed5ae3548238e4.zip | |
rustdoc: use a single box to store Attributes and ItemKind
Diffstat (limited to 'src/librustdoc/json')
| -rw-r--r-- | src/librustdoc/json/conversions.rs | 6 | ||||
| -rw-r--r-- | src/librustdoc/json/import_finder.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/json/mod.rs | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/librustdoc/json/conversions.rs b/src/librustdoc/json/conversions.rs index b97d710c007..cae8d107da4 100644 --- a/src/librustdoc/json/conversions.rs +++ b/src/librustdoc/json/conversions.rs @@ -49,7 +49,7 @@ impl JsonRenderer<'_> { let visibility = item.visibility(self.tcx); let clean::Item { name, item_id, .. } = item; let id = id_from_item(&item, self.tcx); - let inner = match *item.kind { + let inner = match item.kind { clean::KeywordItem => return None, clean::StrippedItem(ref inner) => { match &**inner { @@ -294,7 +294,7 @@ pub(crate) fn id_from_item_inner( } pub(crate) fn id_from_item(item: &clean::Item, tcx: TyCtxt<'_>) -> Id { - match *item.kind { + match item.kind { clean::ItemKind::ImportItem(ref import) => { let extra = import.source.did.map(ItemId::from).map(|i| id_from_item_inner(i, tcx, None, None)); @@ -310,7 +310,7 @@ fn from_clean_item(item: clean::Item, tcx: TyCtxt<'_>) -> ItemEnum { let is_crate = item.is_crate(); let header = item.fn_header(tcx); - match *item.kind { + match item.inner.kind { ModuleItem(m) => { ItemEnum::Module(Module { is_crate, items: ids(m.items, tcx), is_stripped: false }) } diff --git a/src/librustdoc/json/import_finder.rs b/src/librustdoc/json/import_finder.rs index 976a7fd69ae..e21fe9668d4 100644 --- a/src/librustdoc/json/import_finder.rs +++ b/src/librustdoc/json/import_finder.rs @@ -24,7 +24,7 @@ struct ImportFinder { impl DocFolder for ImportFinder { fn fold_item(&mut self, i: Item) -> Option<Item> { - match *i.kind { + match i.kind { clean::ImportItem(Import { source: ImportSource { did: Some(did), .. }, .. }) => { self.imported.insert(did); Some(i) diff --git a/src/librustdoc/json/mod.rs b/src/librustdoc/json/mod.rs index 1b2d61a7637..d375946a8c8 100644 --- a/src/librustdoc/json/mod.rs +++ b/src/librustdoc/json/mod.rs @@ -85,7 +85,7 @@ impl<'tcx> JsonRenderer<'tcx> { // document primitive items in an arbitrary crate by using // `rustc_doc_primitive`. let mut is_primitive_impl = false; - if let clean::types::ItemKind::ImplItem(ref impl_) = *item.kind + if let clean::types::ItemKind::ImplItem(ref impl_) = item.kind && impl_.trait_.is_none() && let clean::types::Type::Primitive(_) = impl_.for_ { @@ -164,7 +164,7 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> { // Flatten items that recursively store other items. We include orphaned items from // stripped modules and etc that are otherwise reachable. - if let ItemKind::StrippedItem(inner) = &*item.kind { + if let ItemKind::StrippedItem(inner) = &item.kind { inner.inner_items().for_each(|i| self.item(i.clone()).unwrap()); } |
