Rollup merge of #120194 - HTGAzureX1212:HTGAzureX1212shorten-option-must-use, r=Nilstrieb

Shorten `#[must_use]` Diagnostic Message for `Option::is_none`

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:
Matthias Krüger 2024-01-22 07:56:43 +01:00 committed by GitHub
commit 1df60b2257
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")]