Skip to content

Commit 452ab26

Browse files
committed
refactor(using_as): improve readability by using sum() instead of fold()
1 parent 0b7f3fe commit 452ab26

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

exercises/conversions/using_as.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// I AM NOT DONE
99

1010
fn average(values: &[f64]) -> f64 {
11-
let total = values.iter().fold(0.0, |a, b| a + b);
11+
let total = values.iter().sum::<f64>();
1212
total / values.len()
1313
}
1414

0 commit comments

Comments
 (0)