Skip to content

Commit 17c630a

Browse files
committed
doc: small tasks guide improvements
1 parent 51b901e commit 17c630a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/doc/guide-tasks.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,9 @@ closure in the new task.
8989
fn print_message() { println!("I am running in a different task!"); }
9090
spawn(print_message);
9191
92-
// Print something profound in a different task using a `proc` expression
92+
// Alternatively, use a `proc` expression instead of a named function.
9393
// The `proc` expression evaluates to an (unnamed) owned closure.
9494
// That closure will call `println!(...)` when the spawned task runs.
95-
9695
spawn(proc() println!("I am also running in a different task!") );
9796
~~~~
9897

@@ -352,14 +351,14 @@ fn main() {
352351

353352
The function `pnorm` performs a simple computation on the vector (it computes the sum of its items
354353
at the power given as argument and takes the inverse power of this value). The Arc on the vector is
355-
created by the line
354+
created by the line:
356355

357356
~~~
358357
# use std::rand;
359358
# use std::sync::Arc;
360359
# fn main() {
361360
# let numbers = Vec::from_fn(1000000, |_| rand::random::<f64>());
362-
let numbers_arc=Arc::new(numbers);
361+
let numbers_arc = Arc::new(numbers);
363362
# }
364363
~~~
365364

0 commit comments

Comments
 (0)