Remove box syntax from Box<rustdoc::clean::types::ItemKind> construction

The type has 240 bytes according to compiler internal rustdoc.
This commit is contained in:
est31 2022-07-11 00:08:55 +02:00
parent 9fa62f2d85
commit e62f6a0e87
4 changed files with 8 additions and 8 deletions

View File

@ -538,7 +538,7 @@ fn build_module(
attrs: Box::new(clean::Attributes::default()),
item_id: ItemId::Primitive(prim_ty, did.krate),
visibility: clean::Public,
kind: box clean::ImportItem(clean::Import::new_simple(
kind: Box::new(clean::ImportItem(clean::Import::new_simple(
item.ident.name,
clean::ImportSource {
path: clean::Path {
@ -554,7 +554,7 @@ fn build_module(
did: None,
},
true,
)),
))),
cfg: None,
});
} else if let Some(i) = try_inline(cx, did, None, res, item.ident.name, None, visited) {

View File

@ -2108,7 +2108,7 @@ fn clean_extern_crate<'tcx>(
attrs: Box::new(attrs.clean(cx)),
item_id: crate_def_id.into(),
visibility: clean_visibility(ty_vis),
kind: box ExternCrateItem { src: orig_name },
kind: Box::new(ExternCrateItem { src: orig_name }),
cfg: attrs.cfg(cx.tcx, &cx.cache.hidden_cfg),
}]
}

View File

@ -502,7 +502,7 @@ impl Item {
clean_visibility(cx.tcx.visibility(def_id))
};
Item { item_id: def_id.into(), kind: box kind, name, attrs, visibility, cfg }
Item { item_id: def_id.into(), kind: Box::new(kind), name, attrs, visibility, cfg }
}
/// Finds all `doc` attributes as NameValues and returns their corresponding values, joined

View File

@ -2,7 +2,7 @@ use crate::clean::*;
pub(crate) fn strip_item(mut item: Item) -> Item {
if !matches!(*item.kind, StrippedItem(..)) {
item.kind = box StrippedItem(item.kind);
item.kind = Box::new(StrippedItem(item.kind));
}
item
}
@ -75,10 +75,10 @@ pub(crate) trait DocFolder: Sized {
/// don't override!
fn fold_item_recur(&mut self, mut item: Item) -> Item {
item.kind = box match *item.kind {
StrippedItem(box i) => StrippedItem(box self.fold_inner_recur(i)),
item.kind = Box::new(match *item.kind {
StrippedItem(box i) => StrippedItem(Box::new(self.fold_inner_recur(i))),
_ => self.fold_inner_recur(*item.kind),
};
});
item
}