Skip to content

Commit 446a322

Browse files
authored
Merge pull request #958 from steveklabnik/master
fix formatting of examples in for
2 parents 1e284cd + 359f0cd commit 446a322

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/flow_control/for.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ collection.
4444
```rust, editable
4545
let names = vec!["Bob", "Frank", "Ferris"];
4646
47-
for name in names.iter() {
48-
match name {
49-
&"Ferris" => println!("There is a rustacean among us!"),
50-
_ => println!("Hello {}", name),
51-
}
47+
for name in names.iter() {
48+
match name {
49+
&"Ferris" => println!("There is a rustacean among us!"),
50+
_ => println!("Hello {}", name),
5251
}
52+
}
5353
```
5454

5555
* `into_iter` - This consumes the collection so that on each iteration the exact
@@ -60,11 +60,11 @@ let names = vec!["Bob", "Frank", "Ferris"];
6060
let names = vec!["Bob", "Frank", "Ferris"];
6161
6262
for name in names.into_iter() {
63-
match name {
64-
"Ferris" => println!("There is a rustacean among us!"),
65-
_ => println!("Hello {}", name),
66-
}
63+
match name {
64+
"Ferris" => println!("There is a rustacean among us!"),
65+
_ => println!("Hello {}", name),
6766
}
67+
}
6868
```
6969

7070
* `iter_mut` - This mutably borrows each element of the collection, allowing for
@@ -74,11 +74,11 @@ for name in names.into_iter() {
7474
let mut names = vec!["Bob", "Frank", "Ferris"];
7575
7676
for name in names.iter_mut() {
77-
match name {
78-
&mut "Ferris" => println!("There is a rustacean among us!"),
79-
_ => println!("Hello {}", name),
80-
}
77+
match name {
78+
&mut "Ferris" => println!("There is a rustacean among us!"),
79+
_ => println!("Hello {}", name),
8180
}
81+
}
8282
```
8383

8484
In the above snippets note the type of `match` branch, that is the key

0 commit comments

Comments
 (0)