@@ -392,8 +392,8 @@ impl<'tcx> Clean<Type> for ty::ProjectionTy<'tcx> {
392392 Type :: QPath {
393393 name : cx. tcx . associated_item ( self . item_def_id ) . ident . name ,
394394 self_def_id : self_type. def_id ( ) ,
395- self_type : Box :: new ( self_type) ,
396- trait_ : Box :: new ( trait_) ,
395+ self_type : box self_type,
396+ trait_ : box trait_,
397397 }
398398 }
399399}
@@ -1284,8 +1284,8 @@ fn clean_qpath(hir_ty: &hir::Ty<'_>, cx: &mut DocContext<'_>) -> Type {
12841284 Type :: QPath {
12851285 name : p. segments . last ( ) . expect ( "segments were empty" ) . ident . name ,
12861286 self_def_id : Some ( DefId :: local ( qself. hir_id . owner . local_def_index ) ) ,
1287- self_type : Box :: new ( qself. clean ( cx) ) ,
1288- trait_ : Box :: new ( resolve_type ( cx, trait_path) ) ,
1287+ self_type : box qself. clean ( cx) ,
1288+ trait_ : box resolve_type ( cx, trait_path) ,
12891289 }
12901290 }
12911291 hir:: QPath :: TypeRelative ( ref qself, ref segment) => {
@@ -1300,8 +1300,8 @@ fn clean_qpath(hir_ty: &hir::Ty<'_>, cx: &mut DocContext<'_>) -> Type {
13001300 Type :: QPath {
13011301 name : segment. ident . name ,
13021302 self_def_id : res. opt_def_id ( ) ,
1303- self_type : Box :: new ( qself. clean ( cx) ) ,
1304- trait_ : Box :: new ( resolve_type ( cx, trait_path) ) ,
1303+ self_type : box qself. clean ( cx) ,
1304+ trait_ : box resolve_type ( cx, trait_path) ,
13051305 }
13061306 }
13071307 hir:: QPath :: LangItem ( ..) => bug ! ( "clean: requiring documentation of lang item" ) ,
@@ -1314,7 +1314,7 @@ impl Clean<Type> for hir::Ty<'_> {
13141314
13151315 match self . kind {
13161316 TyKind :: Never => Never ,
1317- TyKind :: Ptr ( ref m) => RawPointer ( m. mutbl , Box :: new ( m. ty . clean ( cx) ) ) ,
1317+ TyKind :: Ptr ( ref m) => RawPointer ( m. mutbl , box m. ty . clean ( cx) ) ,
13181318 TyKind :: Rptr ( ref l, ref m) => {
13191319 // There are two times a `Fresh` lifetime can be created:
13201320 // 1. For `&'_ x`, written by the user. This corresponds to `lower_lifetime` in `rustc_ast_lowering`.
@@ -1326,9 +1326,9 @@ impl Clean<Type> for hir::Ty<'_> {
13261326 let elided =
13271327 l. is_elided ( ) || matches ! ( l. name, LifetimeName :: Param ( ParamName :: Fresh ( _) ) ) ;
13281328 let lifetime = if elided { None } else { Some ( l. clean ( cx) ) } ;
1329- BorrowedRef { lifetime, mutability : m. mutbl , type_ : Box :: new ( m. ty . clean ( cx) ) }
1329+ BorrowedRef { lifetime, mutability : m. mutbl , type_ : box m. ty . clean ( cx) }
13301330 }
1331- TyKind :: Slice ( ref ty) => Slice ( Box :: new ( ty. clean ( cx) ) ) ,
1331+ TyKind :: Slice ( ref ty) => Slice ( box ty. clean ( cx) ) ,
13321332 TyKind :: Array ( ref ty, ref length) => {
13331333 let def_id = cx. tcx . hir ( ) . local_def_id ( length. hir_id ) ;
13341334 // NOTE(min_const_generics): We can't use `const_eval_poly` for constants
@@ -1341,7 +1341,7 @@ impl Clean<Type> for hir::Ty<'_> {
13411341 let ct = ty:: Const :: from_anon_const ( cx. tcx , def_id) ;
13421342 let param_env = cx. tcx . param_env ( def_id) ;
13431343 let length = print_const ( cx, ct. eval ( cx. tcx , param_env) ) ;
1344- Array ( Box :: new ( ty. clean ( cx) ) , length)
1344+ Array ( box ty. clean ( cx) , length)
13451345 }
13461346 TyKind :: Tup ( ref tys) => Tuple ( tys. clean ( cx) ) ,
13471347 TyKind :: OpaqueDef ( item_id, _) => {
@@ -1358,7 +1358,7 @@ impl Clean<Type> for hir::Ty<'_> {
13581358 let lifetime = if !lifetime. is_elided ( ) { Some ( lifetime. clean ( cx) ) } else { None } ;
13591359 DynTrait ( bounds, lifetime)
13601360 }
1361- TyKind :: BareFn ( ref barefn) => BareFunction ( Box :: new ( barefn. clean ( cx) ) ) ,
1361+ TyKind :: BareFn ( ref barefn) => BareFunction ( box barefn. clean ( cx) ) ,
13621362 // Rustdoc handles `TyKind::Err`s by turning them into `Type::Infer`s.
13631363 TyKind :: Infer | TyKind :: Err => Infer ,
13641364 TyKind :: Typeof ( ..) => panic ! ( "unimplemented type {:?}" , self . kind) ,
@@ -1409,29 +1409,27 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
14091409 ty:: Uint ( uint_ty) => Primitive ( uint_ty. into ( ) ) ,
14101410 ty:: Float ( float_ty) => Primitive ( float_ty. into ( ) ) ,
14111411 ty:: Str => Primitive ( PrimitiveType :: Str ) ,
1412- ty:: Slice ( ty) => Slice ( Box :: new ( ty. clean ( cx) ) ) ,
1412+ ty:: Slice ( ty) => Slice ( box ty. clean ( cx) ) ,
14131413 ty:: Array ( ty, n) => {
14141414 let mut n = cx. tcx . lift ( n) . expect ( "array lift failed" ) ;
14151415 n = n. eval ( cx. tcx , ty:: ParamEnv :: reveal_all ( ) ) ;
14161416 let n = print_const ( cx, n) ;
1417- Array ( Box :: new ( ty. clean ( cx) ) , n)
1417+ Array ( box ty. clean ( cx) , n)
1418+ }
1419+ ty:: RawPtr ( mt) => RawPointer ( mt. mutbl , box mt. ty . clean ( cx) ) ,
1420+ ty:: Ref ( r, ty, mutbl) => {
1421+ BorrowedRef { lifetime : r. clean ( cx) , mutability : mutbl, type_ : box ty. clean ( cx) }
14181422 }
1419- ty:: RawPtr ( mt) => RawPointer ( mt. mutbl , Box :: new ( mt. ty . clean ( cx) ) ) ,
1420- ty:: Ref ( r, ty, mutbl) => BorrowedRef {
1421- lifetime : r. clean ( cx) ,
1422- mutability : mutbl,
1423- type_ : Box :: new ( ty. clean ( cx) ) ,
1424- } ,
14251423 ty:: FnDef ( ..) | ty:: FnPtr ( _) => {
14261424 let ty = cx. tcx . lift ( * self ) . expect ( "FnPtr lift failed" ) ;
14271425 let sig = ty. fn_sig ( cx. tcx ) ;
14281426 let def_id = DefId :: local ( CRATE_DEF_INDEX ) ;
1429- BareFunction ( Box :: new ( BareFunctionDecl {
1427+ BareFunction ( box BareFunctionDecl {
14301428 unsafety : sig. unsafety ( ) ,
14311429 generic_params : Vec :: new ( ) ,
14321430 decl : ( def_id, sig) . clean ( cx) ,
14331431 abi : sig. abi ( ) ,
1434- } ) )
1432+ } )
14351433 }
14361434 ty:: Adt ( def, substs) => {
14371435 let did = def. did ;
@@ -1974,10 +1972,10 @@ fn clean_extern_crate(
19741972 // FIXME: using `from_def_id_and_kind` breaks `rustdoc/masked` for some reason
19751973 vec ! [ Item {
19761974 name: Some ( name) ,
1977- attrs: Box :: new ( attrs. clean( cx) ) ,
1975+ attrs: box attrs. clean( cx) ,
19781976 def_id: crate_def_id. into( ) ,
19791977 visibility: krate. vis. clean( cx) ,
1980- kind: Box :: new ( ExternCrateItem { src: orig_name } ) ,
1978+ kind: box ExternCrateItem { src: orig_name } ,
19811979 cfg: attrs. cfg( cx. sess( ) ) ,
19821980 } ]
19831981}
0 commit comments