about summary refs log tree commit diff
diff options
context:
space:
mode:
authorHTGAzureX1212 <39023054+HTGAzureX1212@users.noreply.github.com>2024-01-21 18:39:09 +0800
committerGitHub <noreply@github.com>2024-01-21 18:39:09 +0800
commit1821bfaa095273523bd06a9e72075962e040daad (patch)
tree49ff7988a3a030c6aa225b09e1747353bf9842f8
parent867d39cdf625e4db4b381faff993346582e598b4 (diff)
downloadrust-1821bfaa095273523bd06a9e72075962e040daad.tar.gz
rust-1821bfaa095273523bd06a9e72075962e040daad.zip
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.
-rw-r--r--library/core/src/option.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/library/core/src/option.rs b/library/core/src/option.rs
index ce29352ba19..c94e7d73a2a 100644
--- a/library/core/src/option.rs
+++ b/library/core/src/option.rs
@@ -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")]