Skip to content

Commit

Permalink
Add missing unwrap()s
Browse files Browse the repository at this point in the history
`tx.send()` returns a `Result` which must be used otherwise the compiler produces warnings.
  • Loading branch information
akhi3030 authored Mar 4, 2024
1 parent 278a2b1 commit f374a82
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions content/tokio/tutorial/channels.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,13 @@ async fn main() {
let tx2 = tx.clone();

tokio::spawn(async move {
tx.send("sending from first handle").await;
// send() returns a `Result` which cannot be ignored.
tx.send("sending from first handle").await.unwrap();
});

tokio::spawn(async move {
tx2.send("sending from second handle").await;
// send() returns a `Result` which cannot be ignored.
tx2.send("sending from second handle").await.unwrap();
});

while let Some(message) = rx.recv().await {
Expand Down

0 comments on commit f374a82

Please sign in to comment.