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 {
3232
3333 #[ test]
3434 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 ) ) ;
3936 }
4037
4138 #[ test]
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ fn test_ioerror() {
6565 assert_eq ! ( "uh-oh!" , read_and_validate( & mut b) . unwrap_err( ) . to_string( ) ) ;
6666}
6767
68- #[ derive( PartialEq , Debug ) ]
68+ #[ derive( PartialEq , Debug ) ]
6969struct PositiveNonzeroInteger ( u64 ) ;
7070
7171impl PositiveNonzeroInteger {
@@ -83,11 +83,14 @@ impl PositiveNonzeroInteger {
8383#[ test]
8484fn test_positive_nonzero_integer_creation ( ) {
8585 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+ ) ;
8790 assert_eq ! ( Err ( CreationError :: Zero ) , PositiveNonzeroInteger :: new( 0 ) ) ;
8891}
8992
90- #[ derive( PartialEq , Debug ) ]
93+ #[ derive( PartialEq , Debug ) ]
9194enum CreationError {
9295 Negative ,
9396 Zero ,
Original file line number Diff line number Diff line change @@ -11,7 +11,10 @@ fn main() {
1111 println ! ( "The last item in the list is {:?}" , last) ;
1212
1313 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+ ) ;
1518}
1619
1720
Original file line number Diff line number Diff line change 11// result1.rs
22// Make this test pass! Scroll down for hints :)
33
4- #[ derive( PartialEq , Debug ) ]
4+ #[ derive( PartialEq , Debug ) ]
55struct PositiveNonzeroInteger ( u64 ) ;
66
7- #[ derive( PartialEq , Debug ) ]
7+ #[ derive( PartialEq , Debug ) ]
88enum CreationError {
99 Negative ,
1010 Zero ,
@@ -19,7 +19,10 @@ impl PositiveNonzeroInteger {
1919#[ test]
2020fn test_creation ( ) {
2121 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+ ) ;
2326 assert_eq ! ( Err ( CreationError :: Zero ) , PositiveNonzeroInteger :: new( 0 ) ) ;
2427}
2528
You can’t perform that action at this time.
0 commit comments