Skip to content

Commit 3fa637d

Browse files
committed
Remove box syntax for Box<rustdoc::clean::types::Type> construction
The type has 80 bytes according to compiler internal rustdoc.
1 parent 88d72a9 commit 3fa637d

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/librustdoc/clean/mod.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ fn clean_projection<'tcx>(
403403
Type::QPath {
404404
assoc: Box::new(projection_to_path_segment(ty, cx)),
405405
should_show_cast,
406-
self_type: box self_type,
406+
self_type: Box::new(self_type),
407407
trait_,
408408
}
409409
}
@@ -1320,7 +1320,7 @@ fn clean_qpath<'tcx>(hir_ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> Type
13201320
Type::QPath {
13211321
assoc: Box::new(p.segments.last().expect("segments were empty").clean(cx)),
13221322
should_show_cast,
1323-
self_type: box self_type,
1323+
self_type: Box::new(self_type),
13241324
trait_,
13251325
}
13261326
}
@@ -1340,7 +1340,7 @@ fn clean_qpath<'tcx>(hir_ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> Type
13401340
Type::QPath {
13411341
assoc: Box::new(segment.clean(cx)),
13421342
should_show_cast,
1343-
self_type: box self_type,
1343+
self_type: Box::new(self_type),
13441344
trait_,
13451345
}
13461346
}
@@ -1440,7 +1440,7 @@ impl<'tcx> Clean<'tcx, Type> for hir::Ty<'tcx> {
14401440

14411441
match self.kind {
14421442
TyKind::Never => Primitive(PrimitiveType::Never),
1443-
TyKind::Ptr(ref m) => RawPointer(m.mutbl, box m.ty.clean(cx)),
1443+
TyKind::Ptr(ref m) => RawPointer(m.mutbl, Box::new(m.ty.clean(cx))),
14441444
TyKind::Rptr(ref l, ref m) => {
14451445
// There are two times a `Fresh` lifetime can be created:
14461446
// 1. For `&'_ x`, written by the user. This corresponds to `lower_lifetime` in `rustc_ast_lowering`.
@@ -1452,9 +1452,9 @@ impl<'tcx> Clean<'tcx, Type> for hir::Ty<'tcx> {
14521452
let elided =
14531453
l.is_elided() || matches!(l.name, LifetimeName::Param(_, ParamName::Fresh));
14541454
let lifetime = if elided { None } else { Some(l.clean(cx)) };
1455-
BorrowedRef { lifetime, mutability: m.mutbl, type_: box m.ty.clean(cx) }
1455+
BorrowedRef { lifetime, mutability: m.mutbl, type_: Box::new(m.ty.clean(cx)) }
14561456
}
1457-
TyKind::Slice(ty) => Slice(box ty.clean(cx)),
1457+
TyKind::Slice(ty) => Slice(Box::new(ty.clean(cx))),
14581458
TyKind::Array(ty, ref length) => {
14591459
let length = match length {
14601460
hir::ArrayLen::Infer(_, _) => "_".to_string(),
@@ -1473,7 +1473,7 @@ impl<'tcx> Clean<'tcx, Type> for hir::Ty<'tcx> {
14731473
}
14741474
};
14751475

1476-
Array(box ty.clean(cx), length)
1476+
Array(Box::new(ty.clean(cx)), length)
14771477
}
14781478
TyKind::Tup(tys) => Tuple(tys.iter().map(|x| x.clean(cx)).collect()),
14791479
TyKind::OpaqueDef(item_id, _) => {
@@ -1540,16 +1540,16 @@ fn clean_ty<'tcx>(this: Ty<'tcx>, cx: &mut DocContext<'tcx>, def_id: Option<DefI
15401540
ty::Uint(uint_ty) => Primitive(uint_ty.into()),
15411541
ty::Float(float_ty) => Primitive(float_ty.into()),
15421542
ty::Str => Primitive(PrimitiveType::Str),
1543-
ty::Slice(ty) => Slice(box ty.clean(cx)),
1543+
ty::Slice(ty) => Slice(Box::new(ty.clean(cx))),
15441544
ty::Array(ty, n) => {
15451545
let mut n = cx.tcx.lift(n).expect("array lift failed");
15461546
n = n.eval(cx.tcx, ty::ParamEnv::reveal_all());
15471547
let n = print_const(cx, n);
1548-
Array(box ty.clean(cx), n)
1548+
Array(Box::new(ty.clean(cx)), n)
15491549
}
1550-
ty::RawPtr(mt) => RawPointer(mt.mutbl, box mt.ty.clean(cx)),
1550+
ty::RawPtr(mt) => RawPointer(mt.mutbl, Box::new(mt.ty.clean(cx))),
15511551
ty::Ref(r, ty, mutbl) => {
1552-
BorrowedRef { lifetime: r.clean(cx), mutability: mutbl, type_: box ty.clean(cx) }
1552+
BorrowedRef { lifetime: r.clean(cx), mutability: mutbl, type_: Box::new(ty.clean(cx)) }
15531553
}
15541554
ty::FnDef(..) | ty::FnPtr(_) => {
15551555
let ty = cx.tcx.lift(this).expect("FnPtr lift failed");

0 commit comments

Comments
 (0)