Skip to content

Commit 7e3f5f8

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

File tree

1 file changed

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

1 file changed

+2
-2
lines changed

compiler/rustc_driver_impl/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#![feature(lazy_cell)]
1313
#![feature(let_chains)]
1414
#![feature(panic_update_hook)]
15+
#![feature(result_flattening)]
1516
#![recursion_limit = "256"]
1617
#![deny(rustc::untranslatable_diagnostic)]
1718
#![deny(rustc::diagnostic_outside_of_impl)]
@@ -1249,8 +1250,7 @@ pub fn catch_fatal_errors<F: FnOnce() -> R, R>(f: F) -> Result<R, ErrorGuarantee
12491250
/// Variant of `catch_fatal_errors` for the `interface::Result` return type
12501251
/// that also computes the exit code.
12511252
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 {
1253+
match catch_fatal_errors(f).flatten() {
12541254
Ok(()) => EXIT_SUCCESS,
12551255
Err(_) => EXIT_FAILURE,
12561256
}

0 commit comments

Comments
 (0)