1
0
Fork 0

cargo fmt

main
Andrew Coleman 2022-12-02 08:56:16 -05:00
parent 7f02eb867c
commit 9a4ecb0907
1 changed files with 5 additions and 1 deletions

View File

@ -21,7 +21,11 @@ pub fn run() -> Result<()> {
let mut sorted_calories = calories.clone(); let mut sorted_calories = calories.clone();
sorted_calories.sort_by(|a, b| b.cmp(a)); sorted_calories.sort_by(|a, b| b.cmp(a));
let top_three: u32 = sorted_calories.get(0..3).expect("Not able to be sorted").iter().sum(); let top_three: u32 = sorted_calories
.get(0..3)
.expect("Not able to be sorted")
.iter()
.sum();
println!("Top 3 calories {}", top_three); println!("Top 3 calories {}", top_three);
Ok(()) Ok(())
} }