Skip to content

Commit 1237aa5

Browse files
authored
Merge pull request #969 from Fointard/fointard_using_as
refactor(using_as): improve readability by using sum() instead of fold()
2 parents b3734ba + 452ab26 commit 1237aa5

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)