Skip to content

Commit b7dba33

Browse files
committed
doc: perform some 80-chars wrappings
1 parent 5371146 commit b7dba33

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

src/doc/rust.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ Two examples of paths with type arguments:
471471
# fn f() {
472472
# fn id<T>(t: T) -> T { t }
473473
type T = HashMap<int,~str>; // Type arguments used in a type expression
474-
let x = id::<int>(10); // Type arguments used in a call expression
474+
let x = id::<int>(10); // Type arguments used in a call expression
475475
# }
476476
~~~~
477477

src/doc/tutorial.md

+13-9
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,8 @@ The obvious approach is to define `Cons` as containing an element in the list
982982
along with the next `List` node. However, this will generate a compiler error.
983983

984984
~~~ {.ignore}
985-
// error: illegal recursive enum type; wrap the inner value in a box to make it representable
985+
// error: illegal recursive enum type; wrap the inner value in a box to make it
986+
// representable
986987
enum List {
987988
Cons(u32, List), // an element (`u32`) and the next node in the list
988989
Nil
@@ -1054,10 +1055,10 @@ immutable, the whole list is immutable. The memory allocation itself is the
10541055
box, while the owner holds onto a pointer to it:
10551056

10561057
~~~ {.notrust}
1057-
List box List box List box List box
1058-
+--------------+ +--------------+ +--------------+ +--------------+
1059-
list -> | Cons | 1 | ~ | -> | Cons | 2 | ~ | -> | Cons | 3 | ~ | -> | Nil |
1060-
+--------------+ +--------------+ +--------------+ +--------------+
1058+
List box List box List box List box
1059+
+--------------+ +--------------+ +--------------+ +----------+
1060+
list -> | Cons | 1 | ~ | -> | Cons | 2 | ~ | -> | Cons | 3 | ~ | -> | Nil |
1061+
+--------------+ +--------------+ +--------------+ +----------+
10611062
~~~
10621063

10631064
> *Note:* the above diagram shows the logical contents of the enum. The actual
@@ -1197,7 +1198,8 @@ fn eq(xs: &List, ys: &List) -> bool {
11971198
// If we have reached the end of both lists, they are equal.
11981199
(&Nil, &Nil) => true,
11991200
// If the current element in both lists is equal, keep going.
1200-
(&Cons(x, ~ref next_xs), &Cons(y, ~ref next_ys)) if x == y => eq(next_xs, next_ys),
1201+
(&Cons(x, ~ref next_xs), &Cons(y, ~ref next_ys))
1202+
if x == y => eq(next_xs, next_ys),
12011203
// If the current elements are not equal, the lists are not equal.
12021204
_ => false
12031205
}
@@ -1256,7 +1258,7 @@ Using the generic `List<T>` works much like before, thanks to type inference:
12561258
# Cons(value, ~xs)
12571259
# }
12581260
let mut xs = Nil; // Unknown type! This is a `List<T>`, but `T` can be anything.
1259-
xs = prepend(xs, 10); // The compiler infers the type of `xs` as `List<int>` from this.
1261+
xs = prepend(xs, 10); // Here the compiler infers `xs`'s type as `List<int>`.
12601262
xs = prepend(xs, 15);
12611263
xs = prepend(xs, 20);
12621264
~~~
@@ -1303,7 +1305,8 @@ fn eq<T: Eq>(xs: &List<T>, ys: &List<T>) -> bool {
13031305
// If we have reached the end of both lists, they are equal.
13041306
(&Nil, &Nil) => true,
13051307
// If the current element in both lists is equal, keep going.
1306-
(&Cons(ref x, ~ref next_xs), &Cons(ref y, ~ref next_ys)) if x == y => eq(next_xs, next_ys),
1308+
(&Cons(ref x, ~ref next_xs), &Cons(ref y, ~ref next_ys))
1309+
if x == y => eq(next_xs, next_ys),
13071310
// If the current elements are not equal, the lists are not equal.
13081311
_ => false
13091312
}
@@ -1331,7 +1334,8 @@ impl<T: Eq> Eq for List<T> {
13311334
// If we have reached the end of both lists, they are equal.
13321335
(&Nil, &Nil) => true,
13331336
// If the current element in both lists is equal, keep going.
1334-
(&Cons(ref x, ~ref next_xs), &Cons(ref y, ~ref next_ys)) if x == y => next_xs == next_ys,
1337+
(&Cons(ref x, ~ref next_xs), &Cons(ref y, ~ref next_ys))
1338+
if x == y => next_xs == next_ys,
13351339
// If the current elements are not equal, the lists are not equal.
13361340
_ => false
13371341
}

0 commit comments

Comments
 (0)