diff options
| author | bors <bors@rust-lang.org> | 2020-12-29 10:41:01 +0000 | 
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-12-29 10:41:01 +0000 | 
| commit | 158f8d034b15e65ba8dc0d066358dd0632bfcd6e (patch) | |
| tree | ff4da49406acf0d16cc087eb51821586dc6d240d /src/librustdoc/json | |
| parent | e2a2592885539ca97bfb1232669e7519a0c0703b (diff) | |
| parent | 5fce0dd787f319d229ecbd679781655549a418f2 (diff) | |
| download | rust-158f8d034b15e65ba8dc0d066358dd0632bfcd6e.tar.gz rust-158f8d034b15e65ba8dc0d066358dd0632bfcd6e.zip | |
Auto merge of #80014 - jyn514:box-item-kind, r=nnethercote
[rustdoc] Box ItemKind to reduce the size of `Item` This brings the size of `Item` from ``` [src/librustdoc/lib.rs:103] std::mem::size_of::<Item>() = 536 ``` to ``` [src/librustdoc/lib.rs:103] std::mem::size_of::<Item>() = 136 ``` This is an alternative to https://github.com/rust-lang/rust/pull/79967; I don't think it makes sense to make both changes. Helps with #79103.
Diffstat (limited to 'src/librustdoc/json')
| -rw-r--r-- | src/librustdoc/json/conversions.rs | 4 | ||||
| -rw-r--r-- | src/librustdoc/json/mod.rs | 4 | 
2 files changed, 4 insertions, 4 deletions
| diff --git a/src/librustdoc/json/conversions.rs b/src/librustdoc/json/conversions.rs index 3b7ac624ccd..e347f7f8411 100644 --- a/src/librustdoc/json/conversions.rs +++ b/src/librustdoc/json/conversions.rs @@ -19,9 +19,9 @@ impl JsonRenderer<'_> { let item_type = ItemType::from(&item); let deprecation = item.deprecation(self.tcx); let clean::Item { source, name, attrs, kind, visibility, def_id } = item; - match kind { + match *kind { clean::StrippedItem(_) => None, - _ => Some(Item { + kind => Some(Item { id: def_id.into(), crate_id: def_id.krate.as_u32(), name: name.map(|sym| sym.to_string()), diff --git a/src/librustdoc/json/mod.rs b/src/librustdoc/json/mod.rs index dc2bc14e7ce..df7ab9b7361 100644 --- a/src/librustdoc/json/mod.rs +++ b/src/librustdoc/json/mod.rs @@ -178,9 +178,9 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> { cache: &Cache, ) -> Result<(), Error> { use clean::types::ItemKind::*; - if let ModuleItem(m) = &item.kind { + if let ModuleItem(m) = &*item.kind { for item in &m.items { - match &item.kind { + match &*item.kind { // These don't have names so they don't get added to the output by default ImportItem(_) => self.item(item.clone(), cache).unwrap(), ExternCrateItem(_, _) => self.item(item.clone(), cache).unwrap(), | 
