@@ -392,8 +392,8 @@ impl<'tcx> Clean<Type> for ty::ProjectionTy<'tcx> {
392
392
Type :: QPath {
393
393
name : cx. tcx . associated_item ( self . item_def_id ) . ident . name ,
394
394
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_,
397
397
}
398
398
}
399
399
}
@@ -1284,8 +1284,8 @@ fn clean_qpath(hir_ty: &hir::Ty<'_>, cx: &mut DocContext<'_>) -> Type {
1284
1284
Type :: QPath {
1285
1285
name : p. segments . last ( ) . expect ( "segments were empty" ) . ident . name ,
1286
1286
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) ,
1289
1289
}
1290
1290
}
1291
1291
hir:: QPath :: TypeRelative ( ref qself, ref segment) => {
@@ -1300,8 +1300,8 @@ fn clean_qpath(hir_ty: &hir::Ty<'_>, cx: &mut DocContext<'_>) -> Type {
1300
1300
Type :: QPath {
1301
1301
name : segment. ident . name ,
1302
1302
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) ,
1305
1305
}
1306
1306
}
1307
1307
hir:: QPath :: LangItem ( ..) => bug ! ( "clean: requiring documentation of lang item" ) ,
@@ -1314,7 +1314,7 @@ impl Clean<Type> for hir::Ty<'_> {
1314
1314
1315
1315
match self . kind {
1316
1316
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) ) ,
1318
1318
TyKind :: Rptr ( ref l, ref m) => {
1319
1319
// There are two times a `Fresh` lifetime can be created:
1320
1320
// 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<'_> {
1326
1326
let elided =
1327
1327
l. is_elided ( ) || matches ! ( l. name, LifetimeName :: Param ( ParamName :: Fresh ( _) ) ) ;
1328
1328
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) }
1330
1330
}
1331
- TyKind :: Slice ( ref ty) => Slice ( Box :: new ( ty. clean ( cx) ) ) ,
1331
+ TyKind :: Slice ( ref ty) => Slice ( box ty. clean ( cx) ) ,
1332
1332
TyKind :: Array ( ref ty, ref length) => {
1333
1333
let def_id = cx. tcx . hir ( ) . local_def_id ( length. hir_id ) ;
1334
1334
// NOTE(min_const_generics): We can't use `const_eval_poly` for constants
@@ -1341,7 +1341,7 @@ impl Clean<Type> for hir::Ty<'_> {
1341
1341
let ct = ty:: Const :: from_anon_const ( cx. tcx , def_id) ;
1342
1342
let param_env = cx. tcx . param_env ( def_id) ;
1343
1343
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)
1345
1345
}
1346
1346
TyKind :: Tup ( ref tys) => Tuple ( tys. clean ( cx) ) ,
1347
1347
TyKind :: OpaqueDef ( item_id, _) => {
@@ -1358,7 +1358,7 @@ impl Clean<Type> for hir::Ty<'_> {
1358
1358
let lifetime = if !lifetime. is_elided ( ) { Some ( lifetime. clean ( cx) ) } else { None } ;
1359
1359
DynTrait ( bounds, lifetime)
1360
1360
}
1361
- TyKind :: BareFn ( ref barefn) => BareFunction ( Box :: new ( barefn. clean ( cx) ) ) ,
1361
+ TyKind :: BareFn ( ref barefn) => BareFunction ( box barefn. clean ( cx) ) ,
1362
1362
// Rustdoc handles `TyKind::Err`s by turning them into `Type::Infer`s.
1363
1363
TyKind :: Infer | TyKind :: Err => Infer ,
1364
1364
TyKind :: Typeof ( ..) => panic ! ( "unimplemented type {:?}" , self . kind) ,
@@ -1409,29 +1409,27 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
1409
1409
ty:: Uint ( uint_ty) => Primitive ( uint_ty. into ( ) ) ,
1410
1410
ty:: Float ( float_ty) => Primitive ( float_ty. into ( ) ) ,
1411
1411
ty:: Str => Primitive ( PrimitiveType :: Str ) ,
1412
- ty:: Slice ( ty) => Slice ( Box :: new ( ty. clean ( cx) ) ) ,
1412
+ ty:: Slice ( ty) => Slice ( box ty. clean ( cx) ) ,
1413
1413
ty:: Array ( ty, n) => {
1414
1414
let mut n = cx. tcx . lift ( n) . expect ( "array lift failed" ) ;
1415
1415
n = n. eval ( cx. tcx , ty:: ParamEnv :: reveal_all ( ) ) ;
1416
1416
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) }
1418
1422
}
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
- } ,
1425
1423
ty:: FnDef ( ..) | ty:: FnPtr ( _) => {
1426
1424
let ty = cx. tcx . lift ( * self ) . expect ( "FnPtr lift failed" ) ;
1427
1425
let sig = ty. fn_sig ( cx. tcx ) ;
1428
1426
let def_id = DefId :: local ( CRATE_DEF_INDEX ) ;
1429
- BareFunction ( Box :: new ( BareFunctionDecl {
1427
+ BareFunction ( box BareFunctionDecl {
1430
1428
unsafety : sig. unsafety ( ) ,
1431
1429
generic_params : Vec :: new ( ) ,
1432
1430
decl : ( def_id, sig) . clean ( cx) ,
1433
1431
abi : sig. abi ( ) ,
1434
- } ) )
1432
+ } )
1435
1433
}
1436
1434
ty:: Adt ( def, substs) => {
1437
1435
let did = def. did ;
@@ -1974,10 +1972,10 @@ fn clean_extern_crate(
1974
1972
// FIXME: using `from_def_id_and_kind` breaks `rustdoc/masked` for some reason
1975
1973
vec ! [ Item {
1976
1974
name: Some ( name) ,
1977
- attrs: Box :: new ( attrs. clean( cx) ) ,
1975
+ attrs: box attrs. clean( cx) ,
1978
1976
def_id: crate_def_id. into( ) ,
1979
1977
visibility: krate. vis. clean( cx) ,
1980
- kind: Box :: new ( ExternCrateItem { src: orig_name } ) ,
1978
+ kind: box ExternCrateItem { src: orig_name } ,
1981
1979
cfg: attrs. cfg( cx. sess( ) ) ,
1982
1980
} ]
1983
1981
}
0 commit comments