Skip to content

Commit 333e97d

Browse files
committed
Make scoped thread examples consistent
This is a followup to #1020.
1 parent bd270fb commit 333e97d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/concurrency/threads/scoped.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,18 @@ However, you can use a [scoped thread][1] for this:
2626
```rust,editable
2727
use std::thread;
2828
29-
fn main() {
29+
fn foo() {
3030
let s = String::from("Hello");
31-
3231
thread::scope(|scope| {
3332
scope.spawn(|| {
3433
println!("Length: {}", s.len());
3534
});
3635
});
3736
}
37+
38+
fn main() {
39+
foo();
40+
}
3841
```
3942

4043
[1]: https://doc.rust-lang.org/std/thread/fn.scope.html

0 commit comments

Comments
 (0)