diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2024-12-11 01:37:17 +0000 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2024-12-23 03:01:29 +0000 |
| commit | 1f82b45b6a42eca19a9dc48402abdc02574f791d (patch) | |
| tree | ce418466d0d65b18070a26934ea86a16cbe71829 /library/std/src/panicking.rs | |
| parent | e108481f74ff123ad98a63bd107a18d13035b275 (diff) | |
| download | rust-1f82b45b6a42eca19a9dc48402abdc02574f791d.tar.gz rust-1f82b45b6a42eca19a9dc48402abdc02574f791d.zip | |
Use `#[derive(Default)]` instead of manually implementing it
Diffstat (limited to 'library/std/src/panicking.rs')
| -rw-r--r-- | library/std/src/panicking.rs | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/library/std/src/panicking.rs b/library/std/src/panicking.rs index dca5ccca0c4..e7ce5bc6140 100644 --- a/library/std/src/panicking.rs +++ b/library/std/src/panicking.rs @@ -81,7 +81,9 @@ extern "C" fn __rust_foreign_exception() -> ! { rtabort!("Rust cannot catch foreign exceptions"); } +#[derive(Default)] enum Hook { + #[default] Default, Custom(Box<dyn Fn(&PanicHookInfo<'_>) + 'static + Sync + Send>), } @@ -96,13 +98,6 @@ impl Hook { } } -impl Default for Hook { - #[inline] - fn default() -> Hook { - Hook::Default - } -} - static HOOK: RwLock<Hook> = RwLock::new(Hook::Default); /// Registers a custom panic hook, replacing the previously registered hook. |
