diff options
| author | Oliver Schneider <git1984941651981@oli-obk.de> | 2015-03-20 08:19:13 +0100 |
|---|---|---|
| committer | Oliver Schneider <git1984941651981@oli-obk.de> | 2015-03-20 08:19:13 +0100 |
| commit | b4a1e59146c70a12d8c4c1f85c08a2ecf9fb3d2e (patch) | |
| tree | 7b986ee36f81d3566200a9acda28c20b5921e032 /src/libcore | |
| parent | 0084f92302b3352372bfd14ebbf083bae695d16e (diff) | |
| download | rust-b4a1e59146c70a12d8c4c1f85c08a2ecf9fb3d2e.tar.gz rust-b4a1e59146c70a12d8c4c1f85c08a2ecf9fb3d2e.zip | |
don't use Result::ok just to be able to use unwrap/unwrap_or
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/result.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libcore/result.rs b/src/libcore/result.rs index a5b2fddfd5d..8dd91fd6500 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -78,7 +78,7 @@ //! let bad_result: Result<int, int> = bad_result.or_else(|i| Ok(11)); //! //! // Consume the result and return the contents with `unwrap`. -//! let final_awesome_result = good_result.ok().unwrap(); +//! let final_awesome_result = good_result.unwrap(); //! ``` //! //! # Results must be used @@ -460,7 +460,7 @@ impl<T, E> Result<T, E> { /// line.trim_right().parse::<int>().unwrap_or(0) /// }); /// // Add the value if there were no errors, otherwise add 0 - /// sum += val.ok().unwrap_or(0); + /// sum += val.unwrap_or(0); /// } /// /// assert!(sum == 10); |
