diff --git a/src/flow_control/for.md b/src/flow_control/for.md index 591b86637c..99e6458493 100644 --- a/src/flow_control/for.md +++ b/src/flow_control/for.md @@ -49,14 +49,13 @@ fn main() { ## for and iterators The `for in` construct is able to interact with an `Iterator` in several ways. -As discussed in with the [Iterator][iter] trait, if not specified, the `for` -loop will apply the `into_iter` function on the collection provided to convert -the collection into an iterator. This is not the only means to convert a -collection into an iterator however, the other functions available include -`iter` and `iter_mut`. - -These 3 functions will return different views of the data within your -collection. +As discussed in the section on the [Iterator][iter] trait, by default the `for` +loop will apply the `into_iter` function to the collection. However, this is +not the only means of converting collections into iterators. + +`into_iter`, `iter` and `iter_mut` all handle the conversion of a collection +into an iterator in different ways, by providing different views on the data +within. * `iter` - This borrows each element of the collection through each iteration. Thus leaving the collection untouched and available for reuse after the loop. diff --git a/src/flow_control/if_let.md b/src/flow_control/if_let.md index 22bdde8d1b..953e82fd8d 100644 --- a/src/flow_control/if_let.md +++ b/src/flow_control/if_let.md @@ -99,7 +99,7 @@ fn main() { } ``` -Another benefit: `if let` allows to match enum non-parameterized variants, even if the enum doesn't `#[derive(PartialEq)]`, neither we implement `PartialEq` for it. In such case, classic `if Foo::Bar==a` fails, because instances of such enum are not comparable for equality. However, `if let` works. +Another benefit is that `if let` allows us to match non-parameterized enum variants. This is true even in cases where the enum doesn't implement or derive `PartialEq`. In such cases `if Foo::Bar == a` would fail to compile, because instances of the enum cannot be equated, however `if let` will continue to work. Would you like a challenge? Fix the following example to use `if let`: