From 9aec4abc4d1edb9eacf86c4152675aeddb30694d Mon Sep 17 00:00:00 2001 From: Eddy Petrisor Date: Wed, 22 May 2019 14:48:32 +0300 Subject: [PATCH] rustfmt the exercises Signed-off-by: Eddy Petrisor --- exercises/error_handling/errors2.rs | 5 +---- exercises/error_handling/errorsn.rs | 9 ++++++--- exercises/error_handling/option1.rs | 5 ++++- exercises/error_handling/result1.rs | 9 ++++++--- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/exercises/error_handling/errors2.rs b/exercises/error_handling/errors2.rs index d97f3b7..8b81207 100644 --- a/exercises/error_handling/errors2.rs +++ b/exercises/error_handling/errors2.rs @@ -32,10 +32,7 @@ mod tests { #[test] fn item_quantity_is_a_valid_number() { - assert_eq!( - total_cost("34"), - Ok(171) - ); + assert_eq!(total_cost("34"), Ok(171)); } #[test] diff --git a/exercises/error_handling/errorsn.rs b/exercises/error_handling/errorsn.rs index cd76d5b..8d39967 100644 --- a/exercises/error_handling/errorsn.rs +++ b/exercises/error_handling/errorsn.rs @@ -65,7 +65,7 @@ fn test_ioerror() { assert_eq!("uh-oh!", read_and_validate(&mut b).unwrap_err().to_string()); } -#[derive(PartialEq,Debug)] +#[derive(PartialEq, Debug)] struct PositiveNonzeroInteger(u64); impl PositiveNonzeroInteger { @@ -83,11 +83,14 @@ impl PositiveNonzeroInteger { #[test] fn test_positive_nonzero_integer_creation() { assert!(PositiveNonzeroInteger::new(10).is_ok()); - assert_eq!(Err(CreationError::Negative), PositiveNonzeroInteger::new(-10)); + assert_eq!( + Err(CreationError::Negative), + PositiveNonzeroInteger::new(-10) + ); assert_eq!(Err(CreationError::Zero), PositiveNonzeroInteger::new(0)); } -#[derive(PartialEq,Debug)] +#[derive(PartialEq, Debug)] enum CreationError { Negative, Zero, diff --git a/exercises/error_handling/option1.rs b/exercises/error_handling/option1.rs index 9cf0bc9..13fc720 100644 --- a/exercises/error_handling/option1.rs +++ b/exercises/error_handling/option1.rs @@ -11,7 +11,10 @@ fn main() { println!("The last item in the list is {:?}", last); let second_to_last = list.pop().unwrap(); - println!("The second-to-last item in the list is {:?}", second_to_last); + println!( + "The second-to-last item in the list is {:?}", + second_to_last + ); } diff --git a/exercises/error_handling/result1.rs b/exercises/error_handling/result1.rs index 851ab45..f9596e2 100644 --- a/exercises/error_handling/result1.rs +++ b/exercises/error_handling/result1.rs @@ -1,10 +1,10 @@ // result1.rs // Make this test pass! Scroll down for hints :) -#[derive(PartialEq,Debug)] +#[derive(PartialEq, Debug)] struct PositiveNonzeroInteger(u64); -#[derive(PartialEq,Debug)] +#[derive(PartialEq, Debug)] enum CreationError { Negative, Zero, @@ -19,7 +19,10 @@ impl PositiveNonzeroInteger { #[test] fn test_creation() { assert!(PositiveNonzeroInteger::new(10).is_ok()); - assert_eq!(Err(CreationError::Negative), PositiveNonzeroInteger::new(-10)); + assert_eq!( + Err(CreationError::Negative), + PositiveNonzeroInteger::new(-10) + ); assert_eq!(Err(CreationError::Zero), PositiveNonzeroInteger::new(0)); }