Skip to content

Commit

Permalink
Alter libcore::result example to utilize closure param
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
frewsxcv committed Apr 6, 2015
1 parent 9f37ba6 commit 1a28237
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libcore/result.rs
Expand Up @@ -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();
Expand Down

0 comments on commit 1a28237

Please sign in to comment.