about summary refs log tree commit diff
path: root/library/std/src/panic.rs
diff options
context:
space:
mode:
authorEric Huss <eric@huss.org>2025-02-12 14:12:16 -0800
committerEric Huss <eric@huss.org>2025-02-13 13:10:27 -0800
commit7dc9e057428f4f235de2fec90218980bac7c46a7 (patch)
treeff58071f65c924838adacd7608f372806eeea29f /library/std/src/panic.rs
parentc1791a1b48d08ccd2346394498ecf5a993324740 (diff)
downloadrust-7dc9e057428f4f235de2fec90218980bac7c46a7.tar.gz
rust-7dc9e057428f4f235de2fec90218980bac7c46a7.zip
std: Apply dependency_on_unit_never_type_fallback
This generates a warning of irrefutable patterns. I decided to slightly
tweak the example so the closure returns unit, since the intent wasn't
to show the weird behavior of returning `!`.
Diffstat (limited to 'library/std/src/panic.rs')
-rw-r--r--library/std/src/panic.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/library/std/src/panic.rs b/library/std/src/panic.rs
index 153189b8b03..61801db072a 100644
--- a/library/std/src/panic.rs
+++ b/library/std/src/panic.rs
@@ -376,7 +376,9 @@ pub fn catch_unwind<F: FnOnce() -> R + UnwindSafe, R>(f: F) -> Result<R> {
 /// use std::panic;
 ///
 /// let result = panic::catch_unwind(|| {
-///     panic!("oh no!");
+///     if 1 != 2 {
+///         panic!("oh no!");
+///     }
 /// });
 ///
 /// if let Err(err) = result {