Fix TODO: use sum insted of left fold
This commit is contained in:
parent
9607069265
commit
594724759c
|
@ -332,8 +332,9 @@ impl<I: Iterator<Item = Segment>> Iterator for Optimizer<I> {
|
||||||
|
|
||||||
/// Computes the total encoded length of all segments.
|
/// Computes the total encoded length of all segments.
|
||||||
pub fn total_encoded_len(segments: &[Segment], version: Version) -> usize {
|
pub fn total_encoded_len(segments: &[Segment], version: Version) -> usize {
|
||||||
// TODO revert to `.map().sum()` after `sum()` is stable.
|
segments.iter()
|
||||||
segments.iter().fold(0, |acc, seg| acc + seg.encoded_len(version))
|
.map(|seg| seg.encoded_len(version))
|
||||||
|
.sum()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
Loading…
Reference in a new issue