Skip to content

Commit 8f9744d

Browse files
committed
tutorial: Cleanup
1 parent c243c11 commit 8f9744d

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

doc/tutorial.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -478,9 +478,7 @@ a type error. Read about [single-variant enums](#single_variant_enum)
478478
further on if you need to create a type name that's not just a
479479
synonym.
480480

481-
## Literals
482-
483-
### Numeric literals
481+
## Numeric literals
484482

485483
Integers can be written in decimal (`144`), hexadecimal (`0x90`), and
486484
binary (`0b10010000`) base.
@@ -539,7 +537,7 @@ and `f64` can be used to create literals of a specific type. The
539537
suffix `f` can be used to write `float` literals without a dot or
540538
exponent: `3f`.
541539
542-
### Other literals
540+
## Other literals
543541
544542
The nil literal is written just like the type: `()`. The keywords
545543
`true` and `false` produce the boolean literals.
@@ -1224,8 +1222,8 @@ Because of this Rust also introduces a global "exchange heap". Objects
12241222
allocated here have _ownership semantics_, meaning that there is only
12251223
a single variable that refers to them. For this reason they are
12261224
refered to as _unique boxes_. All tasks may allocate objects on this
1227-
heap, then _move_ those allocations to other tasks, avoiding expensive
1228-
copies.
1225+
heap, then transfer ownership of those allocations to other tasks,
1226+
avoiding expensive copies.
12291227
12301228
## What to be aware of
12311229
@@ -1531,10 +1529,9 @@ if favorite_crayon_name.len() > 5 {
15311529
15321530
# Closures
15331531
1534-
Named functions, like those in the previous section, may not refer
1535-
to local variables decalared outside the function - they do not
1536-
close over their environment. For example you couldn't write the
1537-
following:
1532+
Named functions, like those we've seen so far, may not refer to local
1533+
variables decalared outside the function - they do not "close over
1534+
their environment". For example you couldn't write the following:
15381535
15391536
~~~~ {.ignore}
15401537
let foo = 10;
@@ -1557,10 +1554,11 @@ let closure = |arg| println(#fmt("captured_var=%d, arg=%d", captured_var, arg));
15571554
call_closure_with_ten(closure);
15581555
~~~~
15591556
1560-
The types of the arguments are generally omitted, as is the return
1561-
type, because the compiler can almost always infer them. In the rare
1562-
case where the compiler needs assistance though, the arguments and
1563-
return types may be annotated.
1557+
Closures begin with the argument list between bars and are followed by
1558+
a single expression. The types of the arguments are generally omitted,
1559+
as is the return type, because the compiler can almost always infer
1560+
them. In the rare case where the compiler needs assistance though, the
1561+
arguments and return types may be annotated.
15641562
15651563
~~~~
15661564
# type mygoodness = fn(str) -> str; type what_the = int;
@@ -1584,7 +1582,7 @@ position and cannot be stored in structures nor returned from
15841582
functions. Despite the limitations stack closures are used
15851583
pervasively in Rust code.
15861584
1587-
## Boxed closures
1585+
## Shared closures
15881586
15891587
When you need to store a closure in a data structure, a stack closure
15901588
will not do, since the compiler will refuse to let you store it. For

0 commit comments

Comments
 (0)