summary refs log tree commit diff
path: root/src/doc/tutorial.md
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-04-17 15:59:07 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-04-18 10:57:10 -0700
commit675b82657e7d9fd4c824ff3c6dbead1edd1ab515 (patch)
treeac2ffc0405647555976c3b6b90e98a4e9398eb11 /src/doc/tutorial.md
parent7d3b0bf3912fabf52fdd6926900e578e55af1b49 (diff)
downloadrust-675b82657e7d9fd4c824ff3c6dbead1edd1ab515.tar.gz
rust-675b82657e7d9fd4c824ff3c6dbead1edd1ab515.zip
Update the rest of the compiler with ~[T] changes
Diffstat (limited to 'src/doc/tutorial.md')
-rw-r--r--src/doc/tutorial.md8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/doc/tutorial.md b/src/doc/tutorial.md
index b52e1abc1a3..336f296ba25 100644
--- a/src/doc/tutorial.md
+++ b/src/doc/tutorial.md
@@ -1582,12 +1582,12 @@ the elements are mutable if the vector is mutable.
 use std::strbuf::StrBuf;
 
 // A dynamically sized vector (unique vector)
-let mut numbers = ~[1, 2, 3];
+let mut numbers = vec![1, 2, 3];
 numbers.push(4);
 numbers.push(5);
 
 // The type of a unique vector is written as `~[int]`
-let more_numbers: ~[int] = numbers;
+let more_numbers: ~[int] = numbers.move_iter().collect();
 
 // The original `numbers` value can no longer be used, due to move semantics.
 
@@ -1955,8 +1955,8 @@ vector consisting of the result of applying `function` to each element
 of `vector`:
 
 ~~~~
-fn map<T, U>(vector: &[T], function: |v: &T| -> U) -> ~[U] {
-    let mut accumulator = ~[];
+fn map<T, U>(vector: &[T], function: |v: &T| -> U) -> Vec<U> {
+    let mut accumulator = Vec::new();
     for element in vector.iter() {
         accumulator.push(function(element));
     }