From 594724759c64e5d5c2cb1a63b54fcdf79c515b0b Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius Date: Sun, 4 Nov 2018 20:40:44 +0200 Subject: [PATCH] Fix TODO: use sum insted of left fold --- src/optimize.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/optimize.rs b/src/optimize.rs index 3dee91c..bceca6a 100644 --- a/src/optimize.rs +++ b/src/optimize.rs @@ -332,8 +332,9 @@ impl> Iterator for Optimizer { /// Computes the total encoded length of all segments. pub fn total_encoded_len(segments: &[Segment], version: Version) -> usize { - // TODO revert to `.map().sum()` after `sum()` is stable. - segments.iter().fold(0, |acc, seg| acc + seg.encoded_len(version)) + segments.iter() + .map(|seg| seg.encoded_len(version)) + .sum() } #[cfg(test)]