Add messages to Option and Result must_use for is_*
This commit is contained in:
parent
481068a707
commit
145385e7c3
@ -178,7 +178,7 @@ impl<T> Option<T> {
|
|||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// [`Some`]: #variant.Some
|
/// [`Some`]: #variant.Some
|
||||||
#[must_use]
|
#[must_use = "if you intended to assert that this has a value, consider `.unwrap()` instead"]
|
||||||
#[inline]
|
#[inline]
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
pub fn is_some(&self) -> bool {
|
pub fn is_some(&self) -> bool {
|
||||||
@ -201,7 +201,7 @@ impl<T> Option<T> {
|
|||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// [`None`]: #variant.None
|
/// [`None`]: #variant.None
|
||||||
#[must_use]
|
#[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"]
|
||||||
#[inline]
|
#[inline]
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
pub fn is_none(&self) -> bool {
|
pub fn is_none(&self) -> bool {
|
||||||
|
@ -277,7 +277,7 @@ impl<T, E> Result<T, E> {
|
|||||||
/// let x: Result<i32, &str> = Err("Some error message");
|
/// let x: Result<i32, &str> = Err("Some error message");
|
||||||
/// assert_eq!(x.is_ok(), false);
|
/// assert_eq!(x.is_ok(), false);
|
||||||
/// ```
|
/// ```
|
||||||
#[must_use]
|
#[must_use = "if you intended to assert that this is ok, consider `.unwrap()` instead"]
|
||||||
#[inline]
|
#[inline]
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
pub fn is_ok(&self) -> bool {
|
pub fn is_ok(&self) -> bool {
|
||||||
@ -302,7 +302,7 @@ impl<T, E> Result<T, E> {
|
|||||||
/// let x: Result<i32, &str> = Err("Some error message");
|
/// let x: Result<i32, &str> = Err("Some error message");
|
||||||
/// assert_eq!(x.is_err(), true);
|
/// assert_eq!(x.is_err(), true);
|
||||||
/// ```
|
/// ```
|
||||||
#[must_use]
|
#[must_use = "if you intended to assert that this is err, consider `.unwrap_err()` instead"]
|
||||||
#[inline]
|
#[inline]
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
pub fn is_err(&self) -> bool {
|
pub fn is_err(&self) -> bool {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user