Skip to content

Commit 0b34243

Browse files
committed
Auto merge of #29651 - tshepang:misc, r=steveklabnik
2 parents 5ea65c0 + 05dde0d commit 0b34243

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/doc/book/dining-philosophers.md

+8-5
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ short strings anyway.
148148
One last thing you’ll notice: we just define a `Philosopher`, and seemingly
149149
don’t do anything with it. Rust is an ‘expression based’ language, which means
150150
that almost everything in Rust is an expression which returns a value. This is
151-
true of functions as well, the last expression is automatically returned. Since
151+
true of functions as well the last expression is automatically returned. Since
152152
we create a new `Philosopher` as the last expression of this function, we end
153153
up returning it.
154154

@@ -178,8 +178,8 @@ fn main() {
178178
}
179179
```
180180

181-
Here, we create five variable bindings with five new philosophers. These are my
182-
favorite five, but you can substitute anyone you want. If we _didn’t_ define
181+
Here, we create five variable bindings with five new philosophers.
182+
If we _didn’t_ define
183183
that `new()` function, it would look like this:
184184

185185
```rust
@@ -440,10 +440,13 @@ closure as an argument and calls that closure on each element in turn.
440440
Here’s where the concurrency happens. The `thread::spawn` function takes a closure
441441
as an argument and executes that closure in a new thread. This closure needs
442442
an extra annotation, `move`, to indicate that the closure is going to take
443-
ownership of the values it’s capturing. Primarily, the `p` variable of the
443+
ownership of the values it’s capturing. In this case, it's the `p` variable of the
444444
`map` function.
445445

446-
Inside the thread, all we do is call `eat()` on `p`. Also note that the call to `thread::spawn` lacks a trailing semicolon, making this an expression. This distinction is important, yielding the correct return value. For more details, read [Expressions vs. Statements][es].
446+
Inside the thread, all we do is call `eat()` on `p`. Also note that
447+
the call to `thread::spawn` lacks a trailing semicolon, making this an
448+
expression. This distinction is important, yielding the correct return
449+
value. For more details, read [Expressions vs. Statements][es].
447450

448451
[es]: functions.html#expressions-vs-statements
449452

0 commit comments

Comments
 (0)