diff --git a/.all-contributorsrc b/.all-contributorsrc index 26fd5c9..d3f0c2c 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -1146,6 +1146,15 @@ "contributions": [ "content" ] + }, + { + "login": "Fointard", + "name": "Fointard", + "avatar_url": "https://avatars.githubusercontent.com/u/9333398?v=4", + "profile": "https://github.com/Fointard", + "contributions": [ + "content" + ] } ], "contributorsPerLine": 8, diff --git a/AUTHORS.md b/AUTHORS.md index 1dc5647..9b388bb 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -164,6 +164,7 @@ authors.
ragreenburg

🖋
stevenfukase

🖋
J-S-Kim

🖋 +
Fointard

🖋 diff --git a/exercises/conversions/using_as.rs b/exercises/conversions/using_as.rs index 821309e..f3f745f 100644 --- a/exercises/conversions/using_as.rs +++ b/exercises/conversions/using_as.rs @@ -8,7 +8,7 @@ // I AM NOT DONE fn average(values: &[f64]) -> f64 { - let total = values.iter().fold(0.0, |a, b| a + b); + let total = values.iter().sum::(); total / values.len() } diff --git a/exercises/standard_library_types/arc1.rs b/exercises/standard_library_types/arc1.rs index d167380..f60061e 100644 --- a/exercises/standard_library_types/arc1.rs +++ b/exercises/standard_library_types/arc1.rs @@ -32,12 +32,7 @@ fn main() { for offset in 0..8 { let child_numbers = // TODO joinhandles.push(thread::spawn(move || { - let mut i = offset; - let mut sum = 0; - while i < child_numbers.len() { - sum += child_numbers[i]; - i += 8; - } + let sum: u32 = child_numbers.iter().filter(|n| *n % 8 == offset).sum(); println!("Sum of offset {} is {}", offset, sum); })); }