Skip to content

Commit 1821bfa

Browse files
chore: suggest wrapping in an assert!() instead
This shortens the `#[must_use]` diagnostics displayed, in light of the [review comment](https://github.com/rust-lang/rust/pull/62431/files#r300819839) on when this was originally added.
1 parent 867d39c commit 1821bfa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/core/src/option.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ impl<T> Option<T> {
642642
/// assert_eq!(x.is_none(), true);
643643
/// ```
644644
#[must_use = "if you intended to assert that this doesn't have a value, consider \
645-
`.and_then(|_| panic!(\"`Option` had a value when expected `None`\"))` instead"]
645+
wrapping this in an `assert!()` instead"]
646646
#[inline]
647647
#[stable(feature = "rust1", since = "1.0.0")]
648648
#[rustc_const_stable(feature = "const_option_basics", since = "1.48.0")]

0 commit comments

Comments
 (0)