1
Fork 0

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>() = 680
```

to

```
[src/librustdoc/lib.rs:103] std::mem::size_of::<Item>() = 280
```
This commit is contained in:
Joshua Nelson 2020-12-13 11:32:57 -05:00
parent 3ffea60dd5
commit 4a4426377e
20 changed files with 90 additions and 94 deletions

View file

@ -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(),