mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Replacing uses of accumulating fold with sum
This commit is contained in:
parent
fed878710c
commit
dbc654ffa8
1 changed files with 2 additions and 1 deletions
|
@ -7,6 +7,7 @@
|
||||||
use libc::{c_char,c_int,c_void,size_t};
|
use libc::{c_char,c_int,c_void,size_t};
|
||||||
use std::borrow::ToOwned;
|
use std::borrow::ToOwned;
|
||||||
use std::ffi::CString;
|
use std::ffi::CString;
|
||||||
|
use std::iter::AdditiveIterator;
|
||||||
use std::old_io::timer::sleep;
|
use std::old_io::timer::sleep;
|
||||||
#[cfg(target_os="linux")]
|
#[cfg(target_os="linux")]
|
||||||
use std::old_io::File;
|
use std::old_io::File;
|
||||||
|
@ -380,7 +381,7 @@ fn get_resident_segments() -> Vec<(String, u64)> {
|
||||||
// from the "resident" measurement obtained via /proc/<pid>/statm in
|
// from the "resident" measurement obtained via /proc/<pid>/statm in
|
||||||
// get_resident(). It's unclear why this difference occurs; for some
|
// get_resident(). It's unclear why this difference occurs; for some
|
||||||
// processes the measurements match, but for Servo they do not.
|
// processes the measurements match, but for Servo they do not.
|
||||||
let total = segs.iter().fold(0u64, |total, &(_, size)| total + size);
|
let total = segs.iter().map(|&(_, size)| size).sum();
|
||||||
segs.push(("resident-according-to-smaps".to_owned(), total));
|
segs.push(("resident-according-to-smaps".to_owned(), total));
|
||||||
|
|
||||||
// Sort by size; the total will be first.
|
// Sort by size; the total will be first.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue