@@ -1504,7 +1504,7 @@ and [`core::str`]. Here are some examples.
1504
1504
# fn store_crayon_in_nasal_cavity(i: uint, c: Crayon) { }
1505
1505
# fn crayon_to_str(c: Crayon) -> &str { "" }
1506
1506
1507
- let crayons = & [Almond, AntiqueBrass, Apricot];
1507
+ let crayons = [Almond, AntiqueBrass, Apricot];
1508
1508
1509
1509
// Check the length of the vector
1510
1510
assert crayons.len() == 3;
@@ -1679,7 +1679,7 @@ structure.
1679
1679
~~~~
1680
1680
# fn each(v: &[int], op: fn(v: &int)) { }
1681
1681
# fn do_some_work(i: &int) { }
1682
- each(& [1, 2, 3], |n| {
1682
+ each([1, 2, 3], |n| {
1683
1683
do_some_work(n);
1684
1684
});
1685
1685
~~~~
@@ -1690,7 +1690,7 @@ call that can be written more like a built-in control structure:
1690
1690
~~~~
1691
1691
# fn each(v: &[int], op: fn(v: &int)) { }
1692
1692
# fn do_some_work(i: &int) { }
1693
- do each(& [1, 2, 3]) |n| {
1693
+ do each([1, 2, 3]) |n| {
1694
1694
do_some_work(n);
1695
1695
}
1696
1696
~~~~
@@ -1751,7 +1751,7 @@ And using this function to iterate over a vector:
1751
1751
~~~~
1752
1752
# use each = vec::each;
1753
1753
# use println = io::println;
1754
- each(& [2, 4, 8, 5, 16], |n| {
1754
+ each([2, 4, 8, 5, 16], |n| {
1755
1755
if *n % 2 != 0 {
1756
1756
println("found odd number!");
1757
1757
false
@@ -1768,7 +1768,7 @@ to the next iteration, write `loop`.
1768
1768
~~~~
1769
1769
# use each = vec::each;
1770
1770
# use println = io::println;
1771
- for each(& [2, 4, 8, 5, 16]) |n| {
1771
+ for each([2, 4, 8, 5, 16]) |n| {
1772
1772
if *n % 2 != 0 {
1773
1773
println("found odd number!");
1774
1774
break;
@@ -2106,7 +2106,7 @@ impl @Rectangle: Drawable { fn draw() { ... } }
2106
2106
2107
2107
let c: @Circle = @new_circle();
2108
2108
let r: @Rectangle = @new_rectangle();
2109
- draw_all(& [c as @Drawable, r as @Drawable]);
2109
+ draw_all([c as @Drawable, r as @Drawable]);
2110
2110
~~~~
2111
2111
2112
2112
We omit the code for ` new_circle ` and ` new_rectangle ` ; imagine that
0 commit comments