@@ -6,15 +6,15 @@ use uuid::Uuid;
66fn test_get_user_rate_valid_ratings ( ) {
77 let valid_ratings = vec ! [ 1u8 , 2u8 , 3u8 , 4u8 , 5u8 ] ;
88 for rating in valid_ratings {
9- assert ! ( rating >= 1 && rating <= 5 ) ;
9+ assert ! ( ( 1 ..= 5 ) . contains ( & rating ) ) ;
1010 }
1111}
1212
1313#[ test]
1414fn test_invalid_ratings_out_of_range ( ) {
1515 let invalid_ratings = vec ! [ 0u8 , 6u8 , 10u8 , 255u8 ] ;
1616 for rating in invalid_ratings {
17- assert ! ( rating < 1 || rating > 5 ) ;
17+ assert ! ( ! ( 1 ..= 5 ) . contains ( & rating ) ) ;
1818 }
1919}
2020
@@ -27,14 +27,14 @@ fn test_orders_info_empty_order_ids() {
2727#[ test]
2828fn test_orders_info_single_order_id ( ) {
2929 let order_id = Uuid :: new_v4 ( ) ;
30- let order_ids = vec ! [ order_id] ;
30+ let order_ids = [ order_id] ;
3131 assert_eq ! ( order_ids. len( ) , 1 ) ;
3232 assert_eq ! ( order_ids[ 0 ] , order_id) ;
3333}
3434
3535#[ test]
3636fn test_orders_info_multiple_order_ids ( ) {
37- let order_ids = vec ! [ Uuid :: new_v4( ) , Uuid :: new_v4( ) , Uuid :: new_v4( ) ] ;
37+ let order_ids = [ Uuid :: new_v4 ( ) , Uuid :: new_v4 ( ) , Uuid :: new_v4 ( ) ] ;
3838 assert_eq ! ( order_ids. len( ) , 3 ) ;
3939 assert_ne ! ( order_ids[ 0 ] , order_ids[ 1 ] ) ;
4040 assert_ne ! ( order_ids[ 1 ] , order_ids[ 2 ] ) ;
@@ -111,7 +111,7 @@ fn test_rating_payload_creation() {
111111 match payload {
112112 Payload :: RatingUser ( r) => {
113113 assert_eq ! ( r, rating) ;
114- assert ! ( r >= 1 && r <= 5 ) ;
114+ assert ! ( ( 1 ..= 5 ) . contains ( & r ) ) ;
115115 }
116116 _ => panic ! ( "Expected Payload::RatingUser" ) ,
117117 }
0 commit comments