Skip to content

Commit

Permalink
profiler: simplify total_duration
Browse files Browse the repository at this point in the history
  • Loading branch information
ljedrz committed Dec 17, 2018
1 parent 640c7ff commit 1b549eb
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/librustc_driver/profile/mod.rs
Expand Up @@ -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.
Expand Down

0 comments on commit 1b549eb

Please sign in to comment.