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.
This commit is contained in:
HTGAzureX1212 2024-01-21 18:39:09 +08:00 committed by GitHub
parent 867d39cdf6
commit 1821bfaa09
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -642,7 +642,7 @@ pub fn is_some_and(self, f: impl FnOnce(T) -> bool) -> bool {
/// assert_eq!(x.is_none(), true);
/// ```
#[must_use = "if you intended to assert that this doesn't have a value, consider \
`.and_then(|_| panic!(\"`Option` had a value when expected `None`\"))` instead"]
wrapping this in an `assert!()` instead"]
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "const_option_basics", since = "1.48.0")]