about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorljedrz <ljedrz@gmail.com>2018-12-17 16:30:14 +0100
committerljedrz <ljedrz@gmail.com>2018-12-17 16:41:44 +0100
commit1b549ebbdf30224b229f90f00c79225e1f7b346e (patch)
tree10b3ceb84d903952f018bd31c47d2a4ed785123a /src
parent640c7ff4323ca11ceffb18fdd9c6d02f5a0ce3af (diff)
downloadrust-1b549ebbdf30224b229f90f00c79225e1f7b346e.tar.gz
rust-1b549ebbdf30224b229f90f00c79225e1f7b346e.zip
profiler: simplify total_duration
Diffstat (limited to 'src')
-rw-r--r--src/librustc_driver/profile/mod.rs4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/librustc_driver/profile/mod.rs b/src/librustc_driver/profile/mod.rs
index d334a9476ce..c5750f3cb45 100644
--- a/src/librustc_driver/profile/mod.rs
+++ b/src/librustc_driver/profile/mod.rs
@@ -64,9 +64,7 @@ struct StackFrame {
 }
 
 fn total_duration(traces: &[trace::Rec]) -> Duration {
-    let mut sum : Duration = Duration::new(0, 0);
-    for t in traces.iter() { sum += t.dur_total; }
-    return sum
+    Duration::new(0, 0) + traces.iter().map(|t| t.dur_total).sum()
 }
 
 // profiling thread; retains state (in local variables) and dump traces, upon request.