Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing unwrap()s #753

Merged
merged 2 commits into from
Mar 5, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I don't think the comment is necessary for the documentation. It explains your change well, but I don't think someone who sees it with unwrap() from the beginning will be confused about it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, I removed the comments.

});

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