@@ -16,7 +16,7 @@ use std::num::ParseIntError;
16
16
#[ derive( PartialEq , Debug ) ]
17
17
enum ParsePosNonzeroError {
18
18
Creation ( CreationError ) ,
19
- ParseInt ( ParseIntError )
19
+ ParseInt ( ParseIntError ) ,
20
20
}
21
21
22
22
impl ParsePosNonzeroError {
@@ -27,14 +27,11 @@ impl ParsePosNonzeroError {
27
27
// fn from_parseint...
28
28
}
29
29
30
- fn parse_pos_nonzero ( s : & str )
31
- -> Result < PositiveNonzeroInteger , ParsePosNonzeroError >
32
- {
30
+ fn parse_pos_nonzero ( s : & str ) -> Result < PositiveNonzeroInteger , ParsePosNonzeroError > {
33
31
// TODO: change this to return an appropriate error instead of panicking
34
32
// when `parse()` returns an error.
35
33
let x: i64 = s. parse ( ) . unwrap ( ) ;
36
- PositiveNonzeroInteger :: new ( x)
37
- . map_err ( ParsePosNonzeroError :: from_creation)
34
+ PositiveNonzeroInteger :: new ( x) . map_err ( ParsePosNonzeroError :: from_creation)
38
35
}
39
36
40
37
// Don't change anything below this line.
@@ -53,7 +50,7 @@ impl PositiveNonzeroInteger {
53
50
match value {
54
51
x if x < 0 => Err ( CreationError :: Negative ) ,
55
52
x if x == 0 => Err ( CreationError :: Zero ) ,
56
- x => Ok ( PositiveNonzeroInteger ( x as u64 ) )
53
+ x => Ok ( PositiveNonzeroInteger ( x as u64 ) ) ,
57
54
}
58
55
}
59
56
}
0 commit comments