diff --git a/compiler/load/src/file.rs b/compiler/load/src/file.rs index fcbdd82421..5aa4c662a5 100644 --- a/compiler/load/src/file.rs +++ b/compiler/load/src/file.rs @@ -918,26 +918,19 @@ impl ModuleTiming { end_time, } = self; - end_time - .duration_since(*start_time) - .ok() - .and_then(|t| { - t.checked_sub(*make_specializations).and_then(|t| { - t.checked_sub(*find_specializations).and_then(|t| { - t.checked_sub(*solve).and_then(|t| { - t.checked_sub(*constrain).and_then(|t| { - t.checked_sub(*canonicalize).and_then(|t| { - t.checked_sub(*parse_body).and_then(|t| { - t.checked_sub(*parse_header) - .and_then(|t| t.checked_sub(*read_roc_file)) - }) - }) - }) - }) - }) - }) - }) - .unwrap_or_else(Duration::default) + let calculate = |t: Result| -> Option { + t.ok()? + .checked_sub(*make_specializations)? + .checked_sub(*find_specializations)? + .checked_sub(*solve)? + .checked_sub(*constrain)? + .checked_sub(*canonicalize)? + .checked_sub(*parse_body)? + .checked_sub(*parse_header)? + .checked_sub(*read_roc_file) + }; + + calculate(end_time.duration_since(*start_time)).unwrap_or_else(Duration::default) } }