Browse Source

use `if let` in panic hook instead of `match`

pull/162/head
Fenrir 10 months ago
parent
commit
a65b9ed577
  1. 7
      ctru-rs/src/applets/error.rs

7
ctru-rs/src/applets/error.rs

@ -108,8 +108,7 @@ pub fn set_panic_hook(use_stderr: bool) { @@ -108,8 +108,7 @@ pub fn set_panic_hook(use_stderr: bool) {
// If we get a `WouldBlock` error, we know that the `Gfx` service has been initialized.
// Otherwise fallback to printing over stderr.
match GFX_ACTIVE.try_lock() {
Err(TryLockError::WouldBlock) => {
if let Err(TryLockError::WouldBlock) = GFX_ACTIVE.try_lock() {
if use_stderr {
print_to_stderr(name, panic_info);
}
@ -123,11 +122,9 @@ pub fn set_panic_hook(use_stderr: bool) { @@ -123,11 +122,9 @@ pub fn set_panic_hook(use_stderr: bool) {
unsafe {
popup.launch_unchecked();
}
}
_ => {
} else {
print_to_stderr(name, panic_info);
}
}
}));
fn print_to_stderr(name: &str, panic_info: &std::panic::PanicInfo) {

Loading…
Cancel
Save