Skip to content

Commit 152193b

Browse files
committed
style: format errors6 with rustfmt
1 parent d01ce83 commit 152193b

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

exercises/error_handling/errors6.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use std::num::ParseIntError;
1616
#[derive(PartialEq, Debug)]
1717
enum ParsePosNonzeroError {
1818
Creation(CreationError),
19-
ParseInt(ParseIntError)
19+
ParseInt(ParseIntError),
2020
}
2121

2222
impl ParsePosNonzeroError {
@@ -27,14 +27,11 @@ impl ParsePosNonzeroError {
2727
// fn from_parseint...
2828
}
2929

30-
fn parse_pos_nonzero(s: &str)
31-
-> Result<PositiveNonzeroInteger, ParsePosNonzeroError>
32-
{
30+
fn parse_pos_nonzero(s: &str) -> Result<PositiveNonzeroInteger, ParsePosNonzeroError> {
3331
// TODO: change this to return an appropriate error instead of panicking
3432
// when `parse()` returns an error.
3533
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)
3835
}
3936

4037
// Don't change anything below this line.
@@ -53,7 +50,7 @@ impl PositiveNonzeroInteger {
5350
match value {
5451
x if x < 0 => Err(CreationError::Negative),
5552
x if x == 0 => Err(CreationError::Zero),
56-
x => Ok(PositiveNonzeroInteger(x as u64))
53+
x => Ok(PositiveNonzeroInteger(x as u64)),
5754
}
5855
}
5956
}

0 commit comments

Comments
 (0)