@@ -6,13 +6,14 @@ use crate::fmt::Debug;
66use crate :: rc:: Rc ;
77use crate :: string:: { String , ToString } ;
88use crate :: vec:: Vec ;
9+ use std:: cmp:: Ordering ;
910use std:: convert:: TryFrom ;
1011use std:: iter:: { self , FromIterator } ;
1112use std:: mem;
1213use std:: ops:: Bound :: { self , Excluded , Included , Unbounded } ;
1314use std:: ops:: RangeBounds ;
1415use std:: panic:: { catch_unwind, AssertUnwindSafe } ;
15- use std:: sync:: atomic:: { AtomicUsize , Ordering } ;
16+ use std:: sync:: atomic:: { AtomicUsize , Ordering :: SeqCst } ;
1617
1718mod ord_chaos;
1819use ord_chaos:: { Cyclic3 , Governed , Governor } ;
@@ -1094,7 +1095,7 @@ mod test_drain_filter {
10941095 struct D ;
10951096 impl Drop for D {
10961097 fn drop ( & mut self ) {
1097- if DROPS . fetch_add ( 1 , Ordering :: SeqCst ) == 1 {
1098+ if DROPS . fetch_add ( 1 , SeqCst ) == 1 {
10981099 panic ! ( "panic in `drop`" ) ;
10991100 }
11001101 }
@@ -1105,14 +1106,14 @@ mod test_drain_filter {
11051106
11061107 catch_unwind ( move || {
11071108 drop ( map. drain_filter ( |i, _| {
1108- PREDS . fetch_add ( 1usize << i, Ordering :: SeqCst ) ;
1109+ PREDS . fetch_add ( 1usize << i, SeqCst ) ;
11091110 true
11101111 } ) )
11111112 } )
11121113 . unwrap_err ( ) ;
11131114
1114- assert_eq ! ( PREDS . load( Ordering :: SeqCst ) , 0x011 ) ;
1115- assert_eq ! ( DROPS . load( Ordering :: SeqCst ) , 3 ) ;
1115+ assert_eq ! ( PREDS . load( SeqCst ) , 0x011 ) ;
1116+ assert_eq ! ( DROPS . load( SeqCst ) , 3 ) ;
11161117 }
11171118
11181119 #[ test]
@@ -1123,7 +1124,7 @@ mod test_drain_filter {
11231124 struct D ;
11241125 impl Drop for D {
11251126 fn drop ( & mut self ) {
1126- DROPS . fetch_add ( 1 , Ordering :: SeqCst ) ;
1127+ DROPS . fetch_add ( 1 , SeqCst ) ;
11271128 }
11281129 }
11291130
@@ -1132,7 +1133,7 @@ mod test_drain_filter {
11321133
11331134 catch_unwind ( AssertUnwindSafe ( || {
11341135 drop ( map. drain_filter ( |i, _| {
1135- PREDS . fetch_add ( 1usize << i, Ordering :: SeqCst ) ;
1136+ PREDS . fetch_add ( 1usize << i, SeqCst ) ;
11361137 match i {
11371138 0 => true ,
11381139 _ => panic ! ( ) ,
@@ -1141,8 +1142,8 @@ mod test_drain_filter {
11411142 } ) )
11421143 . unwrap_err ( ) ;
11431144
1144- assert_eq ! ( PREDS . load( Ordering :: SeqCst ) , 0x011 ) ;
1145- assert_eq ! ( DROPS . load( Ordering :: SeqCst ) , 1 ) ;
1145+ assert_eq ! ( PREDS . load( SeqCst ) , 0x011 ) ;
1146+ assert_eq ! ( DROPS . load( SeqCst ) , 1 ) ;
11461147 assert_eq ! ( map. len( ) , 2 ) ;
11471148 assert_eq ! ( map. first_entry( ) . unwrap( ) . key( ) , & 4 ) ;
11481149 assert_eq ! ( map. last_entry( ) . unwrap( ) . key( ) , & 8 ) ;
@@ -1158,7 +1159,7 @@ mod test_drain_filter {
11581159 struct D ;
11591160 impl Drop for D {
11601161 fn drop ( & mut self ) {
1161- DROPS . fetch_add ( 1 , Ordering :: SeqCst ) ;
1162+ DROPS . fetch_add ( 1 , SeqCst ) ;
11621163 }
11631164 }
11641165
@@ -1167,7 +1168,7 @@ mod test_drain_filter {
11671168
11681169 {
11691170 let mut it = map. drain_filter ( |i, _| {
1170- PREDS . fetch_add ( 1usize << i, Ordering :: SeqCst ) ;
1171+ PREDS . fetch_add ( 1usize << i, SeqCst ) ;
11711172 match i {
11721173 0 => true ,
11731174 _ => panic ! ( ) ,
@@ -1180,8 +1181,8 @@ mod test_drain_filter {
11801181 assert ! ( matches!( result, Ok ( None ) ) ) ;
11811182 }
11821183
1183- assert_eq ! ( PREDS . load( Ordering :: SeqCst ) , 0x011 ) ;
1184- assert_eq ! ( DROPS . load( Ordering :: SeqCst ) , 1 ) ;
1184+ assert_eq ! ( PREDS . load( SeqCst ) , 0x011 ) ;
1185+ assert_eq ! ( DROPS . load( SeqCst ) , 1 ) ;
11851186 assert_eq ! ( map. len( ) , 2 ) ;
11861187 assert_eq ! ( map. first_entry( ) . unwrap( ) . key( ) , & 4 ) ;
11871188 assert_eq ! ( map. last_entry( ) . unwrap( ) . key( ) , & 8 ) ;
@@ -1315,8 +1316,6 @@ fn test_zst() {
13151316// undefined.
13161317#[ test]
13171318fn test_bad_zst ( ) {
1318- use std:: cmp:: Ordering ;
1319-
13201319 #[ derive( Clone , Copy , Debug ) ]
13211320 struct Bad ;
13221321
@@ -1763,7 +1762,7 @@ fn test_append_drop_leak() {
17631762
17641763 impl Drop for D {
17651764 fn drop ( & mut self ) {
1766- if DROPS . fetch_add ( 1 , Ordering :: SeqCst ) == 0 {
1765+ if DROPS . fetch_add ( 1 , SeqCst ) == 0 {
17671766 panic ! ( "panic in `drop`" ) ;
17681767 }
17691768 }
@@ -1779,7 +1778,7 @@ fn test_append_drop_leak() {
17791778
17801779 catch_unwind ( move || left. append ( & mut right) ) . unwrap_err ( ) ;
17811780
1782- assert_eq ! ( DROPS . load( Ordering :: SeqCst ) , 4 ) ; // Rust issue #47949 ate one little piggy
1781+ assert_eq ! ( DROPS . load( SeqCst ) , 4 ) ; // Rust issue #47949 ate one little piggy
17831782}
17841783
17851784#[ test]
@@ -1894,7 +1893,7 @@ fn test_into_iter_drop_leak_height_0() {
18941893
18951894 impl Drop for D {
18961895 fn drop ( & mut self ) {
1897- if DROPS . fetch_add ( 1 , Ordering :: SeqCst ) == 3 {
1896+ if DROPS . fetch_add ( 1 , SeqCst ) == 3 {
18981897 panic ! ( "panic in `drop`" ) ;
18991898 }
19001899 }
@@ -1909,7 +1908,7 @@ fn test_into_iter_drop_leak_height_0() {
19091908
19101909 catch_unwind ( move || drop ( map. into_iter ( ) ) ) . unwrap_err ( ) ;
19111910
1912- assert_eq ! ( DROPS . load( Ordering :: SeqCst ) , 5 ) ;
1911+ assert_eq ! ( DROPS . load( SeqCst ) , 5 ) ;
19131912}
19141913
19151914#[ test]
@@ -1921,18 +1920,18 @@ fn test_into_iter_drop_leak_height_1() {
19211920 struct D ;
19221921 impl Drop for D {
19231922 fn drop ( & mut self ) {
1924- if DROPS . fetch_add ( 1 , Ordering :: SeqCst ) == PANIC_POINT . load ( Ordering :: SeqCst ) {
1923+ if DROPS . fetch_add ( 1 , SeqCst ) == PANIC_POINT . load ( SeqCst ) {
19251924 panic ! ( "panic in `drop`" ) ;
19261925 }
19271926 }
19281927 }
19291928
19301929 for panic_point in vec ! [ 0 , 1 , size - 2 , size - 1 ] {
1931- DROPS . store ( 0 , Ordering :: SeqCst ) ;
1932- PANIC_POINT . store ( panic_point, Ordering :: SeqCst ) ;
1930+ DROPS . store ( 0 , SeqCst ) ;
1931+ PANIC_POINT . store ( panic_point, SeqCst ) ;
19331932 let map: BTreeMap < _ , _ > = ( 0 ..size) . map ( |i| ( i, D ) ) . collect ( ) ;
19341933 catch_unwind ( move || drop ( map. into_iter ( ) ) ) . unwrap_err ( ) ;
1935- assert_eq ! ( DROPS . load( Ordering :: SeqCst ) , size) ;
1934+ assert_eq ! ( DROPS . load( SeqCst ) , size) ;
19361935 }
19371936}
19381937
0 commit comments