Skip to content

Commit 9aec4ab

Browse files
committed
rustfmt the exercises
Signed-off-by: Eddy Petrisor <eddy.petrisor@gmail.com>
1 parent a53b3f1 commit 9aec4ab

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

exercises/error_handling/errors2.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff 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]

exercises/error_handling/errorsn.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff 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)]
6969
struct PositiveNonzeroInteger(u64);
7070

7171
impl PositiveNonzeroInteger {
@@ -83,11 +83,14 @@ impl PositiveNonzeroInteger {
8383
#[test]
8484
fn 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)]
9194
enum CreationError {
9295
Negative,
9396
Zero,

exercises/error_handling/option1.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff 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

exercises/error_handling/result1.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// result1.rs
22
// Make this test pass! Scroll down for hints :)
33

4-
#[derive(PartialEq,Debug)]
4+
#[derive(PartialEq, Debug)]
55
struct PositiveNonzeroInteger(u64);
66

7-
#[derive(PartialEq,Debug)]
7+
#[derive(PartialEq, Debug)]
88
enum CreationError {
99
Negative,
1010
Zero,
@@ -19,7 +19,10 @@ impl PositiveNonzeroInteger {
1919
#[test]
2020
fn 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

0 commit comments

Comments
 (0)