Skip to content

Commit 078aff8

Browse files
committed
Auto merge of rust-lang#30221 - thyrgle:concurrency_doc, r=alexcrichton
The example code in the Channels subsection of the rust book give warnings about unused result which must be used, #[warn(unused_must_use)] on by default Added a small pattern match to resolve those warnings.
2 parents 3ffc6f0 + bfb7361 commit 078aff8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/doc/book/concurrency.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,12 +295,12 @@ fn main() {
295295
let mut data = data.lock().unwrap();
296296
*data += 1;
297297

298-
tx.send(());
298+
tx.send(()).unwrap();
299299
});
300300
}
301301

302302
for _ in 0..10 {
303-
rx.recv();
303+
rx.recv().unwrap();
304304
}
305305
}
306306
```
@@ -324,7 +324,7 @@ fn main() {
324324
thread::spawn(move || {
325325
let answer = i * i;
326326

327-
tx.send(answer);
327+
tx.send(answer).unwrap();
328328
});
329329
}
330330

0 commit comments

Comments
 (0)