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

@@ -187,7 +187,7 @@ impl<'a, 'b> CoverageCalculator<'a, 'b> {
impl<'a, 'b> fold::DocFolder for CoverageCalculator<'a, 'b> {
fn fold_item(&mut self, i: clean::Item) -> Option<clean::Item> {
match i.kind {
match *i.kind {
_ if !i.def_id.is_local() => {
// non-local items are skipped because they can be out of the users control,
// especially in the case of trait impls, which rustdoc eagerly inlines