Skip to content

Commit

Permalink
Rollup merge of rust-lang#120194 - HTGAzureX1212:HTGAzureX1212shorten…
Browse files Browse the repository at this point in the history
…-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.
  • Loading branch information
TaKO8Ki authored Jan 21, 2024
2 parents 96131e9 + 1821bfa commit ea631e5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion library/core/src/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ impl<T> Option<T> {
/// 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")]
Expand Down

0 comments on commit ea631e5

Please sign in to comment.