diff options
| author | Tshepang Lekhonkhobe <tshepang@gmail.com> | 2016-03-29 19:59:55 +0200 |
|---|---|---|
| committer | Tshepang Lekhonkhobe <tshepang@gmail.com> | 2016-03-29 19:59:55 +0200 |
| commit | cd92e9f9668dd17e281ef0f2422635adc7c8fd48 (patch) | |
| tree | c1e0be46dff71692159b765944ae6e01d5992b1a | |
| parent | 235d77457d80b549dad3ac36d94f235208a1eafb (diff) | |
| download | rust-cd92e9f9668dd17e281ef0f2422635adc7c8fd48.tar.gz rust-cd92e9f9668dd17e281ef0f2422635adc7c8fd48.zip | |
doc: "mut" not needed for the examples
| -rw-r--r-- | src/doc/book/vectors.md | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/doc/book/vectors.md b/src/doc/book/vectors.md index ceb6b3c003e..e96dddf8c82 100644 --- a/src/doc/book/vectors.md +++ b/src/doc/book/vectors.md @@ -116,11 +116,11 @@ for i in v { ``` Note: You cannot use the vector again once you have iterated by taking ownership of the vector. -You can iterate the vector multiple times by taking a reference to the vector whilst iterating. +You can iterate the vector multiple times by taking a reference to the vector whilst iterating. For example, the following code does not compile. ```rust,ignore -let mut v = vec![1, 2, 3, 4, 5]; +let v = vec![1, 2, 3, 4, 5]; for i in v { println!("Take ownership of the vector and its element {}", i); @@ -134,7 +134,7 @@ for i in v { Whereas the following works perfectly, ```rust -let mut v = vec![1, 2, 3, 4, 5]; +let v = vec![1, 2, 3, 4, 5]; for i in &v { println!("This is a reference to {}", i); |
