diff options
| author | Alex Gaynor <alex.gaynor@gmail.com> | 2019-04-02 22:09:56 +0000 |
|---|---|---|
| committer | Alex Gaynor <agaynor@mozilla.com> | 2019-04-08 12:58:09 -0400 |
| commit | ce5d69480a644011acedd3072eaef61cd72e5850 (patch) | |
| tree | b110096293347cc6386b1e40e902095cbe55e612 /src/libcore | |
| parent | 3750348daff89741e3153e0e120aa70a45ff5b68 (diff) | |
| download | rust-ce5d69480a644011acedd3072eaef61cd72e5850.tar.gz rust-ce5d69480a644011acedd3072eaef61cd72e5850.zip | |
Add must_use annotations to Result::is_ok and is_err
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/option.rs | 2 | ||||
| -rw-r--r-- | src/libcore/result.rs | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 3da92c0a05a..68ef087d84b 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -178,6 +178,7 @@ impl<T> Option<T> { /// ``` /// /// [`Some`]: #variant.Some + #[must_use] #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub fn is_some(&self) -> bool { @@ -200,6 +201,7 @@ impl<T> Option<T> { /// ``` /// /// [`None`]: #variant.None + #[must_use] #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub fn is_none(&self) -> bool { diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 9b7b8368986..e22a9ebbca4 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -277,6 +277,7 @@ impl<T, E> Result<T, E> { /// let x: Result<i32, &str> = Err("Some error message"); /// assert_eq!(x.is_ok(), false); /// ``` + #[must_use] #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub fn is_ok(&self) -> bool { @@ -301,6 +302,7 @@ impl<T, E> Result<T, E> { /// let x: Result<i32, &str> = Err("Some error message"); /// assert_eq!(x.is_err(), true); /// ``` + #[must_use] #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub fn is_err(&self) -> bool { |
