Merge pull request #22 from aignas/TODO-fix-1

Fix TODO: use sum insted of left fold
pull/24/head
kennytm 2018-11-05 10:12:29 +08:00 committed by GitHub
commit cfa679315b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -332,8 +332,9 @@ impl<I: Iterator<Item = Segment>> Iterator for Optimizer<I> {
/// 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)]