summaryrefslogtreecommitdiffstats
path: root/src/doc/rust-by-example/src/error
diff options
context:
space:
mode:
Diffstat (limited to 'src/doc/rust-by-example/src/error')
-rw-r--r--src/doc/rust-by-example/src/error/option_unwrap/and_then.md5
-rw-r--r--src/doc/rust-by-example/src/error/result/result_map.md2
2 files changed, 2 insertions, 5 deletions
diff --git a/src/doc/rust-by-example/src/error/option_unwrap/and_then.md b/src/doc/rust-by-example/src/error/option_unwrap/and_then.md
index c065f2043..42a1f3ec0 100644
--- a/src/doc/rust-by-example/src/error/option_unwrap/and_then.md
+++ b/src/doc/rust-by-example/src/error/option_unwrap/and_then.md
@@ -39,10 +39,7 @@ fn have_recipe(food: Food) -> Option<Food> {
fn cookable_v1(food: Food) -> Option<Food> {
match have_recipe(food) {
None => None,
- Some(food) => match have_ingredients(food) {
- None => None,
- Some(food) => Some(food),
- },
+ Some(food) => have_ingredients(food),
}
}
diff --git a/src/doc/rust-by-example/src/error/result/result_map.md b/src/doc/rust-by-example/src/error/result/result_map.md
index 24537c318..c453d9fa9 100644
--- a/src/doc/rust-by-example/src/error/result/result_map.md
+++ b/src/doc/rust-by-example/src/error/result/result_map.md
@@ -56,7 +56,7 @@ use std::num::ParseIntError;
// As with `Option`, we can use combinators such as `map()`.
// This function is otherwise identical to the one above and reads:
-// Modify n if the value is valid, otherwise pass on the error.
+// Multiply if both values can be parsed from str, otherwise pass on the error.
fn multiply(first_number_str: &str, second_number_str: &str) -> Result<i32, ParseIntError> {
first_number_str.parse::<i32>().and_then(|first_number| {
second_number_str.parse::<i32>().map(|second_number| first_number * second_number)