profile: Simplify profiler's find or insert code.

This commit is contained in:
Emilio Cobos Álvarez 2016-12-25 17:39:26 +01:00
parent cc262c641f
commit ed87fcf6cf
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -296,12 +296,7 @@ impl Profiler {
}
fn find_or_insert(&mut self, k: (ProfilerCategory, Option<TimerMetadata>), t: f64) {
match self.buckets.get_mut(&k) {
None => {},
Some(v) => { v.push(t); return; },
}
self.buckets.insert(k, vec!(t));
self.buckets.entry(k).or_insert_with(Vec::new).push(t);
}
fn handle_msg(&mut self, msg: ProfilerMsg) -> bool {