Skip to content

Commit 9ce759d

Browse files
author
Orion Gonzalez
committed
replace is_some() -> unwrap with if let
1 parent fbce03b commit 9ce759d

File tree

1 file changed

+12
-8
lines changed
  • compiler/rustc_driver_impl/src

1 file changed

+12
-8
lines changed

compiler/rustc_driver_impl/src/lib.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,11 @@ fn run_compiler(
359359
// printing some information without compiling, or exiting immediately
360360
// after parsing, etc.
361361
let early_exit = || {
362-
if let Some(guar) = sess.dcx().has_errors() { Err(guar) } else { Ok(()) }
362+
if let Some(guar) = sess.dcx().has_errors() {
363+
Err(guar)
364+
} else {
365+
Ok(())
366+
}
363367
};
364368

365369
// This implements `-Whelp`. It should be handled very early, like
@@ -463,12 +467,8 @@ fn run_compiler(
463467
linker.link(sess, codegen_backend)?
464468
}
465469

466-
if sess.opts.unstable_opts.print_fuel.is_some() {
467-
eprintln!(
468-
"Fuel used by {}: {}",
469-
sess.opts.unstable_opts.print_fuel.as_ref().unwrap(),
470-
sess.print_fuel.load(Ordering::SeqCst)
471-
);
470+
if let Some(fuel) = sess.opts.unstable_opts.print_fuel.as_deref() {
471+
eprintln!("Fuel used by {}: {}", fuel, sess.print_fuel.load(Ordering::SeqCst));
472472
}
473473

474474
Ok(())
@@ -565,7 +565,11 @@ fn handle_explain(early_dcx: &EarlyDiagCtxt, registry: Registry, code: &str, col
565565
fn show_md_content_with_pager(content: &str, color: ColorConfig) {
566566
let mut fallback_to_println = false;
567567
let pager_name = env::var_os("PAGER").unwrap_or_else(|| {
568-
if cfg!(windows) { OsString::from("more.com") } else { OsString::from("less") }
568+
if cfg!(windows) {
569+
OsString::from("more.com")
570+
} else {
571+
OsString::from("less")
572+
}
569573
});
570574

571575
let mut cmd = Command::new(&pager_name);

0 commit comments

Comments
 (0)