Skip to content

Commit c2b229f

Browse files
committed
Use Result::flatten in catch_with_exit_code
1 parent f4d794e commit c2b229f

File tree

1 file changed

+1
-2
lines changed
  • compiler/rustc_driver_impl/src

1 file changed

+1
-2
lines changed

compiler/rustc_driver_impl/src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1249,8 +1249,7 @@ pub fn catch_fatal_errors<F: FnOnce() -> R, R>(f: F) -> Result<R, ErrorGuarantee
12491249
/// Variant of `catch_fatal_errors` for the `interface::Result` return type
12501250
/// that also computes the exit code.
12511251
pub fn catch_with_exit_code(f: impl FnOnce() -> interface::Result<()>) -> i32 {
1252-
let result = catch_fatal_errors(f).and_then(|result| result);
1253-
match result {
1252+
match catch_fatal_errors(f).flatten() {
12541253
Ok(()) => EXIT_SUCCESS,
12551254
Err(_) => EXIT_FAILURE,
12561255
}

0 commit comments

Comments
 (0)