File tree Expand file tree Collapse file tree 4 files changed +17
-11
lines changed Expand file tree Collapse file tree 4 files changed +17
-11
lines changed Original file line number Diff line number Diff line change @@ -32,10 +32,7 @@ mod tests {
32
32
33
33
#[ test]
34
34
fn item_quantity_is_a_valid_number ( ) {
35
- assert_eq ! (
36
- total_cost( "34" ) ,
37
- Ok ( 171 )
38
- ) ;
35
+ assert_eq ! ( total_cost( "34" ) , Ok ( 171 ) ) ;
39
36
}
40
37
41
38
#[ test]
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ fn test_ioerror() {
65
65
assert_eq ! ( "uh-oh!" , read_and_validate( & mut b) . unwrap_err( ) . to_string( ) ) ;
66
66
}
67
67
68
- #[ derive( PartialEq , Debug ) ]
68
+ #[ derive( PartialEq , Debug ) ]
69
69
struct PositiveNonzeroInteger ( u64 ) ;
70
70
71
71
impl PositiveNonzeroInteger {
@@ -83,11 +83,14 @@ impl PositiveNonzeroInteger {
83
83
#[ test]
84
84
fn test_positive_nonzero_integer_creation ( ) {
85
85
assert ! ( PositiveNonzeroInteger :: new( 10 ) . is_ok( ) ) ;
86
- assert_eq ! ( Err ( CreationError :: Negative ) , PositiveNonzeroInteger :: new( -10 ) ) ;
86
+ assert_eq ! (
87
+ Err ( CreationError :: Negative ) ,
88
+ PositiveNonzeroInteger :: new( -10 )
89
+ ) ;
87
90
assert_eq ! ( Err ( CreationError :: Zero ) , PositiveNonzeroInteger :: new( 0 ) ) ;
88
91
}
89
92
90
- #[ derive( PartialEq , Debug ) ]
93
+ #[ derive( PartialEq , Debug ) ]
91
94
enum CreationError {
92
95
Negative ,
93
96
Zero ,
Original file line number Diff line number Diff line change @@ -11,7 +11,10 @@ fn main() {
11
11
println ! ( "The last item in the list is {:?}" , last) ;
12
12
13
13
let second_to_last = list. pop ( ) . unwrap ( ) ;
14
- println ! ( "The second-to-last item in the list is {:?}" , second_to_last) ;
14
+ println ! (
15
+ "The second-to-last item in the list is {:?}" ,
16
+ second_to_last
17
+ ) ;
15
18
}
16
19
17
20
Original file line number Diff line number Diff line change 1
1
// result1.rs
2
2
// Make this test pass! Scroll down for hints :)
3
3
4
- #[ derive( PartialEq , Debug ) ]
4
+ #[ derive( PartialEq , Debug ) ]
5
5
struct PositiveNonzeroInteger ( u64 ) ;
6
6
7
- #[ derive( PartialEq , Debug ) ]
7
+ #[ derive( PartialEq , Debug ) ]
8
8
enum CreationError {
9
9
Negative ,
10
10
Zero ,
@@ -19,7 +19,10 @@ impl PositiveNonzeroInteger {
19
19
#[ test]
20
20
fn test_creation ( ) {
21
21
assert ! ( PositiveNonzeroInteger :: new( 10 ) . is_ok( ) ) ;
22
- assert_eq ! ( Err ( CreationError :: Negative ) , PositiveNonzeroInteger :: new( -10 ) ) ;
22
+ assert_eq ! (
23
+ Err ( CreationError :: Negative ) ,
24
+ PositiveNonzeroInteger :: new( -10 )
25
+ ) ;
23
26
assert_eq ! ( Err ( CreationError :: Zero ) , PositiveNonzeroInteger :: new( 0 ) ) ;
24
27
}
25
28
You can’t perform that action at this time.
0 commit comments