about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2015-04-06 13:47:24 -0700
committerCorey Farwell <coreyf@rwell.org>2015-04-06 13:47:24 -0700
commit1a28237b4240f267a465e5179decbfdd7a26bf47 (patch)
tree63ad095e136e10216cada957fa5c0a7c34df4c1b /src
parent9f37ba64e812713b273ad9818f05d852f6563b87 (diff)
downloadrust-1a28237b4240f267a465e5179decbfdd7a26bf47.tar.gz
rust-1a28237b4240f267a465e5179decbfdd7a26bf47.zip
Alter libcore::result example to utilize closure param
Since it doesn't utilize the parameter, it's not very idiomatic since it
could just use the `Result::or` method. So this changes the example to
utilize the parameter. As far as I can tell, all the numbers in this
example are completely arbitrary.
Diffstat (limited to 'src')
-rw-r--r--src/libcore/result.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libcore/result.rs b/src/libcore/result.rs
index 67a5ab891f7..4ac169f0068 100644
--- a/src/libcore/result.rs
+++ b/src/libcore/result.rs
@@ -69,7 +69,7 @@
 //! let good_result: Result<bool, i32> = good_result.and_then(|i| Ok(i == 11));
 //!
 //! // Use `or_else` to handle the error.
-//! let bad_result: Result<i32, i32> = bad_result.or_else(|i| Ok(11));
+//! let bad_result: Result<i32, i32> = bad_result.or_else(|i| Ok(i + 20));
 //!
 //! // Consume the result and return the contents with `unwrap`.
 //! let final_awesome_result = good_result.unwrap();