]> git.lizzy.rs Git - rust.git/commitdiff
doc: Fix the 30-minute intro to use += operator.
authorTim Joseph Dumol <tim@timdumol.com>
Mon, 4 Aug 2014 17:30:53 +0000 (01:30 +0800)
committerTim Dumol <tim@timdumol.com>
Mon, 4 Aug 2014 18:02:41 +0000 (02:02 +0800)
The 30-minute intro had a comment mentioning that `+=` will be included in the future. It's already included, and this fixes it to use `+=`.

src/doc/intro.md

index 128d5c9d320595230ffa1d63caf406ef3fc10295..6deaa50867b0d8d6dc1676f98353f61bcce8e982 100644 (file)
@@ -359,10 +359,11 @@ fn main() {
             // Take the lock, along with exclusive access to the underlying array
             let mut numbers = numbers_lock.lock();
 
-            // This is ugly for now, but will be replaced by
-            // `numbers[num as uint] += 1` in the near future.
+            // This is ugly for now because of the need for `get_mut`, but
+            // will be replaced by `numbers[num as uint] += 1`
+            // in the near future.
             // See: https://github.com/rust-lang/rust/issues/6515
-            *numbers.get_mut(num as uint) = *numbers.get_mut(num as uint) + 1;
+            *numbers.get_mut(num as uint) += 1;
 
             println!("{}", (*numbers)[num as uint]);