1
0
mirror of https://github.com/rust-lang/rustlings.git synced 2025-05-23 22:40:20 +02:00

Apply 2024 edition formatting to solutions

This commit is contained in:
mo8it 2025-02-21 13:08:34 +01:00
parent 1eb6c1e469
commit 374c3874af
5 changed files with 9 additions and 19 deletions

View File

@ -1,9 +1,5 @@
fn bigger(a: i32, b: i32) -> i32 { fn bigger(a: i32, b: i32) -> i32 {
if a > b { if a > b { a } else { b }
a
} else {
b
}
} }
fn main() { fn main() {

View File

@ -60,9 +60,11 @@ England,Spain,1,0";
fn build_scores() { fn build_scores() {
let scores = build_scores_table(RESULTS); let scores = build_scores_table(RESULTS);
assert!(["England", "France", "Germany", "Italy", "Poland", "Spain"] assert!(
.into_iter() ["England", "France", "Germany", "Italy", "Poland", "Spain"]
.all(|team_name| scores.contains_key(team_name))); .into_iter()
.all(|team_name| scores.contains_key(team_name))
);
} }
#[test] #[test]

View File

@ -5,11 +5,7 @@
fn longest<'a>(x: &'a str, y: &'a str) -> &'a str { fn longest<'a>(x: &'a str, y: &'a str) -> &'a str {
// ^^^^ ^^ ^^ ^^ // ^^^^ ^^ ^^ ^^
if x.len() > y.len() { if x.len() > y.len() { x } else { y }
x
} else {
y
}
} }
fn main() { fn main() {

View File

@ -1,9 +1,5 @@
fn longest<'a>(x: &'a str, y: &'a str) -> &'a str { fn longest<'a>(x: &'a str, y: &'a str) -> &'a str {
if x.len() > y.len() { if x.len() > y.len() { x } else { y }
x
} else {
y
}
} }
fn main() { fn main() {

View File

@ -62,8 +62,8 @@ mod tests {
// Import `transformer`. // Import `transformer`.
use super::my_module::transformer; use super::my_module::transformer;
use super::my_module::transformer_iter;
use super::Command; use super::Command;
use super::my_module::transformer_iter;
#[test] #[test]
fn it_works() { fn it_works() {