Skip to content

Commit 1b549eb

Browse files
committed
profiler: simplify total_duration
1 parent 640c7ff commit 1b549eb

File tree

1 file changed

+1
-3
lines changed
  • src/librustc_driver/profile

1 file changed

+1
-3
lines changed

src/librustc_driver/profile/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,7 @@ struct StackFrame {
6464
}
6565

6666
fn total_duration(traces: &[trace::Rec]) -> Duration {
67-
let mut sum : Duration = Duration::new(0, 0);
68-
for t in traces.iter() { sum += t.dur_total; }
69-
return sum
67+
Duration::new(0, 0) + traces.iter().map(|t| t.dur_total).sum()
7068
}
7169

7270
// profiling thread; retains state (in local variables) and dump traces, upon request.

0 commit comments

Comments
 (0)