@@ -779,11 +779,11 @@ quickcheck! {
779
779
780
780
fn peek_nth_mut_replace( a: Vec <u16 >, b: Vec <u16 >) -> ( ) {
781
781
let mut it = peek_nth( a. iter( ) ) ;
782
- for i in 0 .. a. len( ) . min( b. len( ) ) {
783
- * it. peek_nth_mut( i) . unwrap( ) = & b [ i ] ;
782
+ for ( i , m ) in b . iter ( ) . enumerate ( ) . take ( a. len( ) . min( b. len( ) ) ) {
783
+ * it. peek_nth_mut( i) . unwrap( ) = m ;
784
784
}
785
- for i in 0 ..a . len ( ) {
786
- assert_eq!( it. next( ) . unwrap( ) , b. get( i) . unwrap_or( & a [ i ] ) ) ;
785
+ for ( i , m ) in a . iter ( ) . enumerate ( ) {
786
+ assert_eq!( it. next( ) . unwrap( ) , b. get( i) . unwrap_or( m ) ) ;
787
787
}
788
788
assert_eq!( it. next( ) , None ) ;
789
789
assert_eq!( it. next( ) , None ) ;
@@ -875,9 +875,8 @@ quickcheck! {
875
875
quickcheck ! {
876
876
fn size_put_back( a: Vec <u8 >, x: Option <u8 >) -> bool {
877
877
let mut it = put_back( a. into_iter( ) ) ;
878
- match x {
879
- Some ( t) => it. put_back( t) ,
880
- None => { }
878
+ if let Some ( t) = x {
879
+ it. put_back( t)
881
880
}
882
881
correct_size_hint( it)
883
882
}
@@ -999,7 +998,7 @@ quickcheck! {
999
998
}
1000
999
}
1001
1000
}
1002
- cmb. next( ) == None
1001
+ cmb. next( ) . is_none ( )
1003
1002
}
1004
1003
}
1005
1004
@@ -1310,7 +1309,7 @@ struct Val(u32, u32);
1310
1309
1311
1310
impl PartialOrd < Val > for Val {
1312
1311
fn partial_cmp ( & self , other : & Val ) -> Option < Ordering > {
1313
- self . 0 . partial_cmp ( & other. 0 )
1312
+ Some ( self . cmp ( other) )
1314
1313
}
1315
1314
}
1316
1315
@@ -1413,7 +1412,7 @@ quickcheck! {
1413
1412
fn at_most_one_i32( a: Vec <i32 >) -> TestResult {
1414
1413
let ret = a. iter( ) . cloned( ) . at_most_one( ) ;
1415
1414
match a. len( ) {
1416
- 0 => TestResult :: from_bool( ret. unwrap( ) == None ) ,
1415
+ 0 => TestResult :: from_bool( ret. unwrap( ) . is_none ( ) ) ,
1417
1416
1 => TestResult :: from_bool( ret. unwrap( ) == Some ( a[ 0 ] ) ) ,
1418
1417
_ => TestResult :: from_bool( ret. unwrap_err( ) . eq( a. iter( ) . cloned( ) ) ) ,
1419
1418
}
0 commit comments