replace match by if let statements if possible

This commit is contained in:
Julien Levesy 2016-12-30 17:17:21 +01:00
parent 608511ddc3
commit b78979d692
7 changed files with 39 additions and 58 deletions

View file

@ -262,12 +262,11 @@ impl Profiler {
// send using the inner channel
// (using ProfilerChan.send() forces an unwrap and sometimes panics for this background profiler)
let ProfilerChan(ref c) = profiler_chan;
match c.send(ProfilerMsg::Time((ProfilerCategory::ApplicationHeartbeat, None),
(start_time, end_time),
(start_energy, end_energy))) {
Ok(_) => {},
Err(_) => return,
};
if let Err(_) = c.send(ProfilerMsg::Time((ProfilerCategory::ApplicationHeartbeat, None),
(start_time, end_time),
(start_energy, end_energy))) {
return;
}
start_time = end_time;
start_energy = end_energy;
}