File tree 1 file changed +4
-4
lines changed
1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -34,12 +34,12 @@ fn have_recipe(food: Food) -> Option<Food> {
34
34
}
35
35
}
36
36
37
- // To make a dish, we need both the ingredients and the recipe .
37
+ // To make a dish, we need both the recipe and the ingredients .
38
38
// We can represent the logic with a chain of `match`es:
39
39
fn cookable_v1(food: Food) -> Option<Food> {
40
- match have_ingredients (food) {
40
+ match have_recipe (food) {
41
41
None => None,
42
- Some(food) => match have_recipe (food) {
42
+ Some(food) => match have_ingredients (food) {
43
43
None => None,
44
44
Some(food) => Some(food),
45
45
},
@@ -48,7 +48,7 @@ fn cookable_v1(food: Food) -> Option<Food> {
48
48
49
49
// This can conveniently be rewritten more compactly with `and_then()`:
50
50
fn cookable_v2(food: Food) -> Option<Food> {
51
- have_ingredients (food).and_then(have_recipe )
51
+ have_recipe (food).and_then(have_ingredients )
52
52
}
53
53
54
54
fn eat(food: Food, day: Day) {
You can’t perform that action at this time.
0 commit comments