@@ -15,66 +15,66 @@ mod owning_ref {
1515
1616 #[ test]
1717 fn new_deref ( ) {
18- let or: OwningRef < Box < ( ) > , ( ) > = OwningRef :: new ( box ( ( ) ) ) ;
18+ let or: OwningRef < Box < ( ) > , ( ) > = OwningRef :: new ( Box :: new ( ( ) ) ) ;
1919 assert_eq ! ( & * or, & ( ) ) ;
2020 }
2121
2222 #[ test]
2323 fn into ( ) {
24- let or: OwningRef < Box < ( ) > , ( ) > = box ( ( ) ) . into ( ) ;
24+ let or: OwningRef < Box < ( ) > , ( ) > = Box :: new ( ( ) ) . into ( ) ;
2525 assert_eq ! ( & * or, & ( ) ) ;
2626 }
2727
2828 #[ test]
2929 fn map_offset_ref ( ) {
30- let or: BoxRef < Example > = box ( example ( ) ) . into ( ) ;
30+ let or: BoxRef < Example > = Box :: new ( example ( ) ) . into ( ) ;
3131 let or: BoxRef < _ , u32 > = or. map ( |x| & x. 0 ) ;
3232 assert_eq ! ( & * or, & 42 ) ;
3333
34- let or: BoxRef < Example > = box ( example ( ) ) . into ( ) ;
34+ let or: BoxRef < Example > = Box :: new ( example ( ) ) . into ( ) ;
3535 let or: BoxRef < _ , u8 > = or. map ( |x| & x. 2 [ 1 ] ) ;
3636 assert_eq ! ( & * or, & 2 ) ;
3737 }
3838
3939 #[ test]
4040 fn map_heap_ref ( ) {
41- let or: BoxRef < Example > = box ( example ( ) ) . into ( ) ;
41+ let or: BoxRef < Example > = Box :: new ( example ( ) ) . into ( ) ;
4242 let or: BoxRef < _ , str > = or. map ( |x| & x. 1 [ ..5 ] ) ;
4343 assert_eq ! ( & * or, "hello" ) ;
4444 }
4545
4646 #[ test]
4747 fn map_static_ref ( ) {
48- let or: BoxRef < ( ) > = box ( ( ) ) . into ( ) ;
48+ let or: BoxRef < ( ) > = Box :: new ( ( ) ) . into ( ) ;
4949 let or: BoxRef < _ , str > = or. map ( |_| "hello" ) ;
5050 assert_eq ! ( & * or, "hello" ) ;
5151 }
5252
5353 #[ test]
5454 fn map_chained ( ) {
55- let or: BoxRef < String > = box ( example ( ) . 1 ) . into ( ) ;
55+ let or: BoxRef < String > = Box :: new ( example ( ) . 1 ) . into ( ) ;
5656 let or: BoxRef < _ , str > = or. map ( |x| & x[ 1 ..5 ] ) ;
5757 let or: BoxRef < _ , str > = or. map ( |x| & x[ ..2 ] ) ;
5858 assert_eq ! ( & * or, "el" ) ;
5959 }
6060
6161 #[ test]
6262 fn map_chained_inference ( ) {
63- let or = BoxRef :: new ( box ( example ( ) . 1 ) ) . map ( |x| & x[ ..5 ] ) . map ( |x| & x[ 1 ..3 ] ) ;
63+ let or = BoxRef :: new ( Box :: new ( example ( ) . 1 ) ) . map ( |x| & x[ ..5 ] ) . map ( |x| & x[ 1 ..3 ] ) ;
6464 assert_eq ! ( & * or, "el" ) ;
6565 }
6666
6767 #[ test]
6868 fn owner ( ) {
69- let or: BoxRef < String > = box ( example ( ) . 1 ) . into ( ) ;
69+ let or: BoxRef < String > = Box :: new ( example ( ) . 1 ) . into ( ) ;
7070 let or = or. map ( |x| & x[ ..5 ] ) ;
7171 assert_eq ! ( & * or, "hello" ) ;
7272 assert_eq ! ( & * * or. owner( ) , "hello world" ) ;
7373 }
7474
7575 #[ test]
7676 fn into_inner ( ) {
77- let or: BoxRef < String > = box ( example ( ) . 1 ) . into ( ) ;
77+ let or: BoxRef < String > = Box :: new ( example ( ) . 1 ) . into ( ) ;
7878 let or = or. map ( |x| & x[ ..5 ] ) ;
7979 assert_eq ! ( & * or, "hello" ) ;
8080 let s = * or. into_inner ( ) ;
@@ -83,17 +83,17 @@ mod owning_ref {
8383
8484 #[ test]
8585 fn fmt_debug ( ) {
86- let or: BoxRef < String > = box ( example ( ) . 1 ) . into ( ) ;
86+ let or: BoxRef < String > = Box :: new ( example ( ) . 1 ) . into ( ) ;
8787 let or = or. map ( |x| & x[ ..5 ] ) ;
8888 let s = format ! ( "{:?}" , or) ;
8989 assert_eq ! ( & s, "OwningRef { owner: \" hello world\" , reference: \" hello\" }" ) ;
9090 }
9191
9292 #[ test]
9393 fn erased_owner ( ) {
94- let o1: BoxRef < Example , str > = BoxRef :: new ( box ( example ( ) ) ) . map ( |x| & x. 1 [ ..] ) ;
94+ let o1: BoxRef < Example , str > = BoxRef :: new ( Box :: new ( example ( ) ) ) . map ( |x| & x. 1 [ ..] ) ;
9595
96- let o2: BoxRef < String , str > = BoxRef :: new ( box ( example ( ) . 1 ) ) . map ( |x| & x[ ..] ) ;
96+ let o2: BoxRef < String , str > = BoxRef :: new ( Box :: new ( example ( ) . 1 ) ) . map ( |x| & x[ ..] ) ;
9797
9898 let os: Vec < ErasedBoxRef < str > > = vec ! [ o1. erase_owner( ) , o2. erase_owner( ) ] ;
9999 assert ! ( os. iter( ) . all( |e| & e[ ..] == "hello world" ) ) ;
@@ -238,7 +238,7 @@ mod owning_ref {
238238 fn try_map1 ( ) {
239239 use std:: any:: Any ;
240240
241- let x = box ( 123_i32 ) ;
241+ let x = Box :: new ( 123_i32 ) ;
242242 let y: Box < dyn Any > = x;
243243
244244 assert ! ( OwningRef :: new( y) . try_map( |x| x. downcast_ref:: <i32 >( ) . ok_or( ( ) ) ) . is_ok( ) ) ;
@@ -248,7 +248,7 @@ mod owning_ref {
248248 fn try_map2 ( ) {
249249 use std:: any:: Any ;
250250
251- let x = box ( 123_i32 ) ;
251+ let x = Box :: new ( 123_i32 ) ;
252252 let y: Box < dyn Any > = x;
253253
254254 assert ! ( !OwningRef :: new( y) . try_map( |x| x. downcast_ref:: <i32 >( ) . ok_or( ( ) ) ) . is_err( ) ) ;
@@ -377,69 +377,69 @@ mod owning_ref_mut {
377377
378378 #[ test]
379379 fn new_deref ( ) {
380- let or: OwningRefMut < Box < ( ) > , ( ) > = OwningRefMut :: new ( box ( ( ) ) ) ;
380+ let or: OwningRefMut < Box < ( ) > , ( ) > = OwningRefMut :: new ( Box :: new ( ( ) ) ) ;
381381 assert_eq ! ( & * or, & ( ) ) ;
382382 }
383383
384384 #[ test]
385385 fn new_deref_mut ( ) {
386- let mut or: OwningRefMut < Box < ( ) > , ( ) > = OwningRefMut :: new ( box ( ( ) ) ) ;
386+ let mut or: OwningRefMut < Box < ( ) > , ( ) > = OwningRefMut :: new ( Box :: new ( ( ) ) ) ;
387387 assert_eq ! ( & mut * or, & mut ( ) ) ;
388388 }
389389
390390 #[ test]
391391 fn mutate ( ) {
392- let mut or: OwningRefMut < Box < usize > , usize > = OwningRefMut :: new ( box ( 0 ) ) ;
392+ let mut or: OwningRefMut < Box < usize > , usize > = OwningRefMut :: new ( Box :: new ( 0 ) ) ;
393393 assert_eq ! ( & * or, & 0 ) ;
394394 * or = 1 ;
395395 assert_eq ! ( & * or, & 1 ) ;
396396 }
397397
398398 #[ test]
399399 fn into ( ) {
400- let or: OwningRefMut < Box < ( ) > , ( ) > = box ( ( ) ) . into ( ) ;
400+ let or: OwningRefMut < Box < ( ) > , ( ) > = Box :: new ( ( ) ) . into ( ) ;
401401 assert_eq ! ( & * or, & ( ) ) ;
402402 }
403403
404404 #[ test]
405405 fn map_offset_ref ( ) {
406- let or: BoxRefMut < Example > = box ( example ( ) ) . into ( ) ;
406+ let or: BoxRefMut < Example > = Box :: new ( example ( ) ) . into ( ) ;
407407 let or: BoxRef < _ , u32 > = or. map ( |x| & mut x. 0 ) ;
408408 assert_eq ! ( & * or, & 42 ) ;
409409
410- let or: BoxRefMut < Example > = box ( example ( ) ) . into ( ) ;
410+ let or: BoxRefMut < Example > = Box :: new ( example ( ) ) . into ( ) ;
411411 let or: BoxRef < _ , u8 > = or. map ( |x| & mut x. 2 [ 1 ] ) ;
412412 assert_eq ! ( & * or, & 2 ) ;
413413 }
414414
415415 #[ test]
416416 fn map_heap_ref ( ) {
417- let or: BoxRefMut < Example > = box ( example ( ) ) . into ( ) ;
417+ let or: BoxRefMut < Example > = Box :: new ( example ( ) ) . into ( ) ;
418418 let or: BoxRef < _ , str > = or. map ( |x| & mut x. 1 [ ..5 ] ) ;
419419 assert_eq ! ( & * or, "hello" ) ;
420420 }
421421
422422 #[ test]
423423 fn map_static_ref ( ) {
424- let or: BoxRefMut < ( ) > = box ( ( ) ) . into ( ) ;
424+ let or: BoxRefMut < ( ) > = Box :: new ( ( ) ) . into ( ) ;
425425 let or: BoxRef < _ , str > = or. map ( |_| "hello" ) ;
426426 assert_eq ! ( & * or, "hello" ) ;
427427 }
428428
429429 #[ test]
430430 fn map_mut_offset_ref ( ) {
431- let or: BoxRefMut < Example > = box ( example ( ) ) . into ( ) ;
431+ let or: BoxRefMut < Example > = Box :: new ( example ( ) ) . into ( ) ;
432432 let or: BoxRefMut < _ , u32 > = or. map_mut ( |x| & mut x. 0 ) ;
433433 assert_eq ! ( & * or, & 42 ) ;
434434
435- let or: BoxRefMut < Example > = box ( example ( ) ) . into ( ) ;
435+ let or: BoxRefMut < Example > = Box :: new ( example ( ) ) . into ( ) ;
436436 let or: BoxRefMut < _ , u8 > = or. map_mut ( |x| & mut x. 2 [ 1 ] ) ;
437437 assert_eq ! ( & * or, & 2 ) ;
438438 }
439439
440440 #[ test]
441441 fn map_mut_heap_ref ( ) {
442- let or: BoxRefMut < Example > = box ( example ( ) ) . into ( ) ;
442+ let or: BoxRefMut < Example > = Box :: new ( example ( ) ) . into ( ) ;
443443 let or: BoxRefMut < _ , str > = or. map_mut ( |x| & mut x. 1 [ ..5 ] ) ;
444444 assert_eq ! ( & * or, "hello" ) ;
445445 }
@@ -450,14 +450,14 @@ mod owning_ref_mut {
450450
451451 let mut_s: & ' static mut [ u8 ] = unsafe { & mut MUT_S } ;
452452
453- let or: BoxRefMut < ( ) > = box ( ( ) ) . into ( ) ;
453+ let or: BoxRefMut < ( ) > = Box :: new ( ( ) ) . into ( ) ;
454454 let or: BoxRefMut < _ , [ u8 ] > = or. map_mut ( move |_| mut_s) ;
455455 assert_eq ! ( & * or, b"hello" ) ;
456456 }
457457
458458 #[ test]
459459 fn map_mut_chained ( ) {
460- let or: BoxRefMut < String > = box ( example ( ) . 1 ) . into ( ) ;
460+ let or: BoxRefMut < String > = Box :: new ( example ( ) . 1 ) . into ( ) ;
461461 let or: BoxRefMut < _ , str > = or. map_mut ( |x| & mut x[ 1 ..5 ] ) ;
462462 let or: BoxRefMut < _ , str > = or. map_mut ( |x| & mut x[ ..2 ] ) ;
463463 assert_eq ! ( & * or, "el" ) ;
@@ -466,32 +466,32 @@ mod owning_ref_mut {
466466 #[ test]
467467 fn map_chained_inference ( ) {
468468 let or =
469- BoxRefMut :: new ( box ( example ( ) . 1 ) ) . map_mut ( |x| & mut x[ ..5 ] ) . map_mut ( |x| & mut x[ 1 ..3 ] ) ;
469+ BoxRefMut :: new ( Box :: new ( example ( ) . 1 ) ) . map_mut ( |x| & mut x[ ..5 ] ) . map_mut ( |x| & mut x[ 1 ..3 ] ) ;
470470 assert_eq ! ( & * or, "el" ) ;
471471 }
472472
473473 #[ test]
474474 fn try_map_mut ( ) {
475- let or: BoxRefMut < String > = box ( example ( ) . 1 ) . into ( ) ;
475+ let or: BoxRefMut < String > = Box :: new ( example ( ) . 1 ) . into ( ) ;
476476 let or: Result < BoxRefMut < _ , str > , ( ) > = or. try_map_mut ( |x| Ok ( & mut x[ 1 ..5 ] ) ) ;
477477 assert_eq ! ( & * or. unwrap( ) , "ello" ) ;
478478
479- let or: BoxRefMut < String > = box ( example ( ) . 1 ) . into ( ) ;
479+ let or: BoxRefMut < String > = Box :: new ( example ( ) . 1 ) . into ( ) ;
480480 let or: Result < BoxRefMut < _ , str > , ( ) > = or. try_map_mut ( |_| Err ( ( ) ) ) ;
481481 assert ! ( or. is_err( ) ) ;
482482 }
483483
484484 #[ test]
485485 fn owner ( ) {
486- let or: BoxRefMut < String > = box ( example ( ) . 1 ) . into ( ) ;
486+ let or: BoxRefMut < String > = Box :: new ( example ( ) . 1 ) . into ( ) ;
487487 let or = or. map_mut ( |x| & mut x[ ..5 ] ) ;
488488 assert_eq ! ( & * or, "hello" ) ;
489489 assert_eq ! ( & * * or. owner( ) , "hello world" ) ;
490490 }
491491
492492 #[ test]
493493 fn into_inner ( ) {
494- let or: BoxRefMut < String > = box ( example ( ) . 1 ) . into ( ) ;
494+ let or: BoxRefMut < String > = Box :: new ( example ( ) . 1 ) . into ( ) ;
495495 let or = or. map_mut ( |x| & mut x[ ..5 ] ) ;
496496 assert_eq ! ( & * or, "hello" ) ;
497497 let s = * or. into_inner ( ) ;
@@ -500,17 +500,17 @@ mod owning_ref_mut {
500500
501501 #[ test]
502502 fn fmt_debug ( ) {
503- let or: BoxRefMut < String > = box ( example ( ) . 1 ) . into ( ) ;
503+ let or: BoxRefMut < String > = Box :: new ( example ( ) . 1 ) . into ( ) ;
504504 let or = or. map_mut ( |x| & mut x[ ..5 ] ) ;
505505 let s = format ! ( "{:?}" , or) ;
506506 assert_eq ! ( & s, "OwningRefMut { owner: \" hello world\" , reference: \" hello\" }" ) ;
507507 }
508508
509509 #[ test]
510510 fn erased_owner ( ) {
511- let o1: BoxRefMut < Example , str > = BoxRefMut :: new ( box ( example ( ) ) ) . map_mut ( |x| & mut x. 1 [ ..] ) ;
511+ let o1: BoxRefMut < Example , str > = BoxRefMut :: new ( Box :: new ( example ( ) ) ) . map_mut ( |x| & mut x. 1 [ ..] ) ;
512512
513- let o2: BoxRefMut < String , str > = BoxRefMut :: new ( box ( example ( ) . 1 ) ) . map_mut ( |x| & mut x[ ..] ) ;
513+ let o2: BoxRefMut < String , str > = BoxRefMut :: new ( Box :: new ( example ( ) . 1 ) ) . map_mut ( |x| & mut x[ ..] ) ;
514514
515515 let os: Vec < ErasedBoxRefMut < str > > = vec ! [ o1. erase_owner( ) , o2. erase_owner( ) ] ;
516516 assert ! ( os. iter( ) . all( |e| & e[ ..] == "hello world" ) ) ;
@@ -593,8 +593,8 @@ mod owning_ref_mut {
593593 #[ test]
594594 fn borrow ( ) {
595595 let mut hash = HashMap :: new ( ) ;
596- let key1 = BoxRefMut :: < String > :: new ( box ( "foo" . to_string ( ) ) ) . map ( |s| & s[ ..] ) ;
597- let key2 = BoxRefMut :: < String > :: new ( box ( "bar" . to_string ( ) ) ) . map ( |s| & s[ ..] ) ;
596+ let key1 = BoxRefMut :: < String > :: new ( Box :: new ( "foo" . to_string ( ) ) ) . map ( |s| & s[ ..] ) ;
597+ let key2 = BoxRefMut :: < String > :: new ( Box :: new ( "bar" . to_string ( ) ) ) . map ( |s| & s[ ..] ) ;
598598
599599 hash. insert ( key1, 42 ) ;
600600 hash. insert ( key2, 23 ) ;
@@ -633,7 +633,7 @@ mod owning_ref_mut {
633633 fn try_map1 ( ) {
634634 use std:: any:: Any ;
635635
636- let x = box ( 123_i32 ) ;
636+ let x = Box :: new ( 123_i32 ) ;
637637 let y: Box < dyn Any > = x;
638638
639639 assert ! ( OwningRefMut :: new( y) . try_map_mut( |x| x. downcast_mut:: <i32 >( ) . ok_or( ( ) ) ) . is_ok( ) ) ;
@@ -643,7 +643,7 @@ mod owning_ref_mut {
643643 fn try_map2 ( ) {
644644 use std:: any:: Any ;
645645
646- let x = box ( 123_i32 ) ;
646+ let x = Box :: new ( 123_i32 ) ;
647647 let y: Box < dyn Any > = x;
648648
649649 assert ! ( !OwningRefMut :: new( y) . try_map_mut( |x| x. downcast_mut:: <i32 >( ) . ok_or( ( ) ) ) . is_err( ) ) ;
@@ -653,7 +653,7 @@ mod owning_ref_mut {
653653 fn try_map3 ( ) {
654654 use std:: any:: Any ;
655655
656- let x = box ( 123_i32 ) ;
656+ let x = Box :: new ( 123_i32 ) ;
657657 let y: Box < dyn Any > = x;
658658
659659 assert ! ( OwningRefMut :: new( y) . try_map( |x| x. downcast_ref:: <i32 >( ) . ok_or( ( ) ) ) . is_ok( ) ) ;
@@ -663,7 +663,7 @@ mod owning_ref_mut {
663663 fn try_map4 ( ) {
664664 use std:: any:: Any ;
665665
666- let x = box ( 123_i32 ) ;
666+ let x = Box :: new ( 123_i32 ) ;
667667 let y: Box < dyn Any > = x;
668668
669669 assert ! ( !OwningRefMut :: new( y) . try_map( |x| x. downcast_ref:: <i32 >( ) . ok_or( ( ) ) ) . is_err( ) ) ;
@@ -673,7 +673,7 @@ mod owning_ref_mut {
673673 fn into_owning_ref ( ) {
674674 use super :: super :: BoxRef ;
675675
676- let or: BoxRefMut < ( ) > = box ( ( ) ) . into ( ) ;
676+ let or: BoxRefMut < ( ) > = Box :: new ( ( ) ) . into ( ) ;
677677 let or: BoxRef < ( ) > = or. into ( ) ;
678678 assert_eq ! ( & * or, & ( ) ) ;
679679 }
0 commit comments