use ? operator more

This commit is contained in:
Folkert 2021-03-02 16:48:12 +01:00
parent 27130c3172
commit ac91db41b7

View file

@ -918,26 +918,19 @@ impl ModuleTiming {
end_time, end_time,
} = self; } = self;
end_time let calculate = |t: Result<Duration, std::time::SystemTimeError>| -> Option<Duration> {
.duration_since(*start_time) t.ok()?
.ok() .checked_sub(*make_specializations)?
.and_then(|t| { .checked_sub(*find_specializations)?
t.checked_sub(*make_specializations).and_then(|t| { .checked_sub(*solve)?
t.checked_sub(*find_specializations).and_then(|t| { .checked_sub(*constrain)?
t.checked_sub(*solve).and_then(|t| { .checked_sub(*canonicalize)?
t.checked_sub(*constrain).and_then(|t| { .checked_sub(*parse_body)?
t.checked_sub(*canonicalize).and_then(|t| { .checked_sub(*parse_header)?
t.checked_sub(*parse_body).and_then(|t| { .checked_sub(*read_roc_file)
t.checked_sub(*parse_header) };
.and_then(|t| t.checked_sub(*read_roc_file))
}) calculate(end_time.duration_since(*start_time)).unwrap_or_else(Duration::default)
})
})
})
})
})
})
.unwrap_or_else(Duration::default)
} }
} }