From f374a82499bde8f3f1ccc2a8e74a61fdc39f457f Mon Sep 17 00:00:00 2001 From: Akhilesh Singhania Date: Mon, 4 Mar 2024 19:55:53 +0100 Subject: [PATCH 1/2] Add missing `unwrap()`s `tx.send()` returns a `Result` which must be used otherwise the compiler produces warnings. --- content/tokio/tutorial/channels.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/content/tokio/tutorial/channels.md b/content/tokio/tutorial/channels.md index 79b65ce5..921bda2b 100644 --- a/content/tokio/tutorial/channels.md +++ b/content/tokio/tutorial/channels.md @@ -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 { From 00d26e217bcb784813913bf15bd4a39599ec3f26 Mon Sep 17 00:00:00 2001 From: Akhilesh Singhania Date: Tue, 5 Mar 2024 10:01:40 +0100 Subject: [PATCH 2/2] Remove superfluous comments --- content/tokio/tutorial/channels.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/content/tokio/tutorial/channels.md b/content/tokio/tutorial/channels.md index 921bda2b..f54f84fa 100644 --- a/content/tokio/tutorial/channels.md +++ b/content/tokio/tutorial/channels.md @@ -175,12 +175,10 @@ async fn main() { let tx2 = tx.clone(); tokio::spawn(async move { - // send() returns a `Result` which cannot be ignored. tx.send("sending from first handle").await.unwrap(); }); tokio::spawn(async move { - // send() returns a `Result` which cannot be ignored. tx2.send("sending from second handle").await.unwrap(); });