Skip to content

Commit f7ce3dc

Browse files
bstriecatamorphism
authored andcommitted
Extraneous sigil patrol: turn &[] literals into []
1 parent 5e1d0ba commit f7ce3dc

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

doc/tutorial.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1504,7 +1504,7 @@ and [`core::str`]. Here are some examples.
15041504
# fn store_crayon_in_nasal_cavity(i: uint, c: Crayon) { }
15051505
# fn crayon_to_str(c: Crayon) -> &str { "" }
15061506
1507-
let crayons = &[Almond, AntiqueBrass, Apricot];
1507+
let crayons = [Almond, AntiqueBrass, Apricot];
15081508
15091509
// Check the length of the vector
15101510
assert crayons.len() == 3;
@@ -1679,7 +1679,7 @@ structure.
16791679
~~~~
16801680
# fn each(v: &[int], op: fn(v: &int)) { }
16811681
# fn do_some_work(i: &int) { }
1682-
each(&[1, 2, 3], |n| {
1682+
each([1, 2, 3], |n| {
16831683
do_some_work(n);
16841684
});
16851685
~~~~
@@ -1690,7 +1690,7 @@ call that can be written more like a built-in control structure:
16901690
~~~~
16911691
# fn each(v: &[int], op: fn(v: &int)) { }
16921692
# fn do_some_work(i: &int) { }
1693-
do each(&[1, 2, 3]) |n| {
1693+
do each([1, 2, 3]) |n| {
16941694
do_some_work(n);
16951695
}
16961696
~~~~
@@ -1751,7 +1751,7 @@ And using this function to iterate over a vector:
17511751
~~~~
17521752
# use each = vec::each;
17531753
# use println = io::println;
1754-
each(&[2, 4, 8, 5, 16], |n| {
1754+
each([2, 4, 8, 5, 16], |n| {
17551755
if *n % 2 != 0 {
17561756
println("found odd number!");
17571757
false
@@ -1768,7 +1768,7 @@ to the next iteration, write `loop`.
17681768
~~~~
17691769
# use each = vec::each;
17701770
# use println = io::println;
1771-
for each(&[2, 4, 8, 5, 16]) |n| {
1771+
for each([2, 4, 8, 5, 16]) |n| {
17721772
if *n % 2 != 0 {
17731773
println("found odd number!");
17741774
break;
@@ -2106,7 +2106,7 @@ impl @Rectangle: Drawable { fn draw() { ... } }
21062106
21072107
let c: @Circle = @new_circle();
21082108
let r: @Rectangle = @new_rectangle();
2109-
draw_all(&[c as @Drawable, r as @Drawable]);
2109+
draw_all([c as @Drawable, r as @Drawable]);
21102110
~~~~
21112111

21122112
We omit the code for `new_circle` and `new_rectangle`; imagine that

0 commit comments

Comments
 (0)