Skip to content

Commit 7f698b7

Browse files
authored
Merge pull request #1305 from matthew-healy/grammar-fixes
Improve grammar in a few sections
2 parents 1c2bd02 + 9d11135 commit 7f698b7

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

src/flow_control/for.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,13 @@ fn main() {
4949
## for and iterators
5050

5151
The `for in` construct is able to interact with an `Iterator` in several ways.
52-
As discussed in with the [Iterator][iter] trait, if not specified, the `for`
53-
loop will apply the `into_iter` function on the collection provided to convert
54-
the collection into an iterator. This is not the only means to convert a
55-
collection into an iterator however, the other functions available include
56-
`iter` and `iter_mut`.
57-
58-
These 3 functions will return different views of the data within your
59-
collection.
52+
As discussed in the section on the [Iterator][iter] trait, by default the `for`
53+
loop will apply the `into_iter` function to the collection. However, this is
54+
not the only means of converting collections into iterators.
55+
56+
`into_iter`, `iter` and `iter_mut` all handle the conversion of a collection
57+
into an iterator in different ways, by providing different views on the data
58+
within.
6059

6160
* `iter` - This borrows each element of the collection through each iteration.
6261
Thus leaving the collection untouched and available for reuse after the loop.

src/flow_control/if_let.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ fn main() {
9999
}
100100
```
101101

102-
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.
102+
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.
103103

104104
Would you like a challenge? Fix the following example to use `if let`:
105105

0 commit comments

Comments
 (0)