diff options
| author | mo8it <mo8it@proton.me> | 2025-02-21 13:08:34 +0100 |
|---|---|---|
| committer | mo8it <mo8it@proton.me> | 2025-02-21 13:08:34 +0100 |
| commit | 374c3874afcd01ed0c88047589967d568ceac49f (patch) | |
| tree | 8e3fa663ad34d7540178393d4de3d1e5f39746a1 /solutions | |
| parent | 1eb6c1e469de2492d823d4739114d8a85cd6660b (diff) | |
Apply 2024 edition formatting to solutions
Diffstat (limited to 'solutions')
| -rw-r--r-- | solutions/03_if/if1.rs | 6 | ||||
| -rw-r--r-- | solutions/11_hashmaps/hashmaps3.rs | 8 | ||||
| -rw-r--r-- | solutions/16_lifetimes/lifetimes1.rs | 6 | ||||
| -rw-r--r-- | solutions/16_lifetimes/lifetimes2.rs | 6 | ||||
| -rw-r--r-- | solutions/quizzes/quiz2.rs | 2 |
5 files changed, 9 insertions, 19 deletions
diff --git a/solutions/03_if/if1.rs b/solutions/03_if/if1.rs index 079c671..8512a60 100644 --- a/solutions/03_if/if1.rs +++ b/solutions/03_if/if1.rs @@ -1,9 +1,5 @@ fn bigger(a: i32, b: i32) -> i32 { - if a > b { - a - } else { - b - } + if a > b { a } else { b } } fn main() { diff --git a/solutions/11_hashmaps/hashmaps3.rs b/solutions/11_hashmaps/hashmaps3.rs index 433b16c..485bf83 100644 --- a/solutions/11_hashmaps/hashmaps3.rs +++ b/solutions/11_hashmaps/hashmaps3.rs @@ -60,9 +60,11 @@ England,Spain,1,0"; fn build_scores() { let scores = build_scores_table(RESULTS); - assert!(["England", "France", "Germany", "Italy", "Poland", "Spain"] - .into_iter() - .all(|team_name| scores.contains_key(team_name))); + assert!( + ["England", "France", "Germany", "Italy", "Poland", "Spain"] + .into_iter() + .all(|team_name| scores.contains_key(team_name)) + ); } #[test] diff --git a/solutions/16_lifetimes/lifetimes1.rs b/solutions/16_lifetimes/lifetimes1.rs index ca7b688..4f56834 100644 --- a/solutions/16_lifetimes/lifetimes1.rs +++ b/solutions/16_lifetimes/lifetimes1.rs @@ -5,11 +5,7 @@ fn longest<'a>(x: &'a str, y: &'a str) -> &'a str { // ^^^^ ^^ ^^ ^^ - if x.len() > y.len() { - x - } else { - y - } + if x.len() > y.len() { x } else { y } } fn main() { diff --git a/solutions/16_lifetimes/lifetimes2.rs b/solutions/16_lifetimes/lifetimes2.rs index b0f2ef1..3ca4909 100644 --- a/solutions/16_lifetimes/lifetimes2.rs +++ b/solutions/16_lifetimes/lifetimes2.rs @@ -1,9 +1,5 @@ fn longest<'a>(x: &'a str, y: &'a str) -> &'a str { - if x.len() > y.len() { - x - } else { - y - } + if x.len() > y.len() { x } else { y } } fn main() { diff --git a/solutions/quizzes/quiz2.rs b/solutions/quizzes/quiz2.rs index 58cbe4e..8b073b1 100644 --- a/solutions/quizzes/quiz2.rs +++ b/solutions/quizzes/quiz2.rs @@ -62,8 +62,8 @@ mod tests { // Import `transformer`. use super::my_module::transformer; - use super::my_module::transformer_iter; use super::Command; + use super::my_module::transformer_iter; #[test] fn it_works() { |
