From b99b093dfe8563f5d1b82e0d90a04a2026fc4be0 Mon Sep 17 00:00:00 2001 From: Sergey Kaunov Date: Fri, 24 Jan 2025 18:23:41 +0300 Subject: [PATCH 1/2] Update select.md improve an example code readability by ditching couple of operations/lines --- content/tokio/tutorial/select.md | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/content/tokio/tutorial/select.md b/content/tokio/tutorial/select.md index c27cab15..d8d6b427 100644 --- a/content/tokio/tutorial/select.md +++ b/content/tokio/tutorial/select.md @@ -644,14 +644,10 @@ The logic we want to implement is: ```rust async fn action(input: Option) -> Option { - // If the input is `None`, return `None`. - // This could also be written as `let i = input?;` - let i = match input { - Some(input) => input, - None => return None, - }; - // async logic here -# Some(i.to_string()) + input.map(|i| { + // async logic here +# input.to_string() + }) } #[tokio::main] From 7482b758045df53e8b1fe5d677e271966bf84744 Mon Sep 17 00:00:00 2001 From: Sergey Kaunov Date: Fri, 24 Jan 2025 18:29:59 +0300 Subject: [PATCH 2/2] Update select.md fix pasting --- content/tokio/tutorial/select.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/tokio/tutorial/select.md b/content/tokio/tutorial/select.md index d8d6b427..39dda706 100644 --- a/content/tokio/tutorial/select.md +++ b/content/tokio/tutorial/select.md @@ -646,7 +646,7 @@ The logic we want to implement is: async fn action(input: Option) -> Option { input.map(|i| { // async logic here -# input.to_string() +# i.to_string() }) }