Skip to content

Commit ccf1bdb

Browse files
committed
Remove box syntax for Box<Attributes> construction
Attributes only has 48 bytes according to compiler internal rustdoc.
1 parent 1ac17fc commit ccf1bdb

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

src/librustdoc/clean/inline.rs

+10-4
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,14 @@ pub(crate) fn try_inline(
124124

125125
let (attrs, cfg) = merge_attrs(cx, Some(parent_module), load_attrs(cx, did), attrs_clone);
126126
cx.inlined.insert(did.into());
127-
let mut item =
128-
clean::Item::from_def_id_and_attrs_and_parts(did, Some(name), kind, box attrs, cx, cfg);
127+
let mut item = clean::Item::from_def_id_and_attrs_and_parts(
128+
did,
129+
Some(name),
130+
kind,
131+
Box::new(attrs),
132+
cx,
133+
cfg,
134+
);
129135
if let Some(import_def_id) = import_def_id {
130136
// The visibility needs to reflect the one from the reexport and not from the "source" DefId.
131137
item.visibility = cx.tcx.visibility(import_def_id).clean(cx);
@@ -506,7 +512,7 @@ pub(crate) fn build_impl(
506512
ImplKind::Normal
507513
},
508514
}),
509-
box merged_attrs,
515+
Box::new(merged_attrs),
510516
cx,
511517
cfg,
512518
));
@@ -535,7 +541,7 @@ fn build_module(
535541
let prim_ty = clean::PrimitiveType::from(p);
536542
items.push(clean::Item {
537543
name: None,
538-
attrs: box clean::Attributes::default(),
544+
attrs: Box::new(clean::Attributes::default()),
539545
item_id: ItemId::Primitive(prim_ty, did.krate),
540546
visibility: clean::Public,
541547
kind: box clean::ImportItem(clean::Import::new_simple(

src/librustdoc/clean/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2062,7 +2062,7 @@ fn clean_extern_crate<'tcx>(
20622062
// FIXME: using `from_def_id_and_kind` breaks `rustdoc/masked` for some reason
20632063
vec![Item {
20642064
name: Some(name),
2065-
attrs: box attrs.clean(cx),
2065+
attrs: Box::new(attrs.clean(cx)),
20662066
item_id: crate_def_id.into(),
20672067
visibility: ty_vis.clean(cx),
20682068
kind: box ExternCrateItem { src: orig_name },

src/librustdoc/clean/types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ impl Item {
477477
def_id,
478478
name,
479479
kind,
480-
box ast_attrs.clean(cx),
480+
Box::new(ast_attrs.clean(cx)),
481481
cx,
482482
ast_attrs.cfg(cx.tcx, &cx.cache.hidden_cfg),
483483
)

0 commit comments

Comments
 (0)