Skip to content

Commit cd92e9f

Browse files
committed
doc: "mut" not needed for the examples
1 parent 235d774 commit cd92e9f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/doc/book/vectors.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,11 @@ for i in v {
116116
```
117117

118118
Note: You cannot use the vector again once you have iterated by taking ownership of the vector.
119-
You can iterate the vector multiple times by taking a reference to the vector whilst iterating.
119+
You can iterate the vector multiple times by taking a reference to the vector whilst iterating.
120120
For example, the following code does not compile.
121121

122122
```rust,ignore
123-
let mut v = vec![1, 2, 3, 4, 5];
123+
let v = vec![1, 2, 3, 4, 5];
124124
125125
for i in v {
126126
println!("Take ownership of the vector and its element {}", i);
@@ -134,7 +134,7 @@ for i in v {
134134
Whereas the following works perfectly,
135135

136136
```rust
137-
let mut v = vec![1, 2, 3, 4, 5];
137+
let v = vec![1, 2, 3, 4, 5];
138138

139139
for i in &v {
140140
println!("This is a reference to {}", i);

0 commit comments

Comments
 (0)