Skip to content

Commit 374c387

Browse files
committed
Apply 2024 edition formatting to solutions
1 parent 1eb6c1e commit 374c387

File tree

5 files changed

+9
-19
lines changed

5 files changed

+9
-19
lines changed

solutions/03_if/if1.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
fn bigger(a: i32, b: i32) -> i32 {
2-
if a > b {
3-
a
4-
} else {
5-
b
6-
}
2+
if a > b { a } else { b }
73
}
84

95
fn main() {

solutions/11_hashmaps/hashmaps3.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,11 @@ England,Spain,1,0";
6060
fn build_scores() {
6161
let scores = build_scores_table(RESULTS);
6262

63-
assert!(["England", "France", "Germany", "Italy", "Poland", "Spain"]
64-
.into_iter()
65-
.all(|team_name| scores.contains_key(team_name)));
63+
assert!(
64+
["England", "France", "Germany", "Italy", "Poland", "Spain"]
65+
.into_iter()
66+
.all(|team_name| scores.contains_key(team_name))
67+
);
6668
}
6769

6870
#[test]

solutions/16_lifetimes/lifetimes1.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@
55

66
fn longest<'a>(x: &'a str, y: &'a str) -> &'a str {
77
// ^^^^ ^^ ^^ ^^
8-
if x.len() > y.len() {
9-
x
10-
} else {
11-
y
12-
}
8+
if x.len() > y.len() { x } else { y }
139
}
1410

1511
fn main() {

solutions/16_lifetimes/lifetimes2.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
fn longest<'a>(x: &'a str, y: &'a str) -> &'a str {
2-
if x.len() > y.len() {
3-
x
4-
} else {
5-
y
6-
}
2+
if x.len() > y.len() { x } else { y }
73
}
84

95
fn main() {

solutions/quizzes/quiz2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ mod tests {
6262
// Import `transformer`.
6363
use super::my_module::transformer;
6464

65-
use super::my_module::transformer_iter;
6665
use super::Command;
66+
use super::my_module::transformer_iter;
6767

6868
#[test]
6969
fn it_works() {

0 commit comments

Comments
 (0)