diff --git a/src/async-rust/tokio/stream.md b/src/async-rust/tokio/stream.md index 58b1773a..c7b07753 100644 --- a/src/async-rust/tokio/stream.md +++ b/src/async-rust/tokio/stream.md @@ -184,7 +184,7 @@ got = b"6" let messages = subscriber .into_stream() .filter_map(|msg| match msg { - Ok(msg) if msg.content.len() == 1 => msg.unwrap().content, + Ok(msg) if msg.content.len() == 1 => Some(msg.content), _ => None, }) .take(3); diff --git a/src/basic/match-pattern/pattern-match.md b/src/basic/match-pattern/pattern-match.md index 5b8837e5..3e823445 100644 --- a/src/basic/match-pattern/pattern-match.md +++ b/src/basic/match-pattern/pattern-match.md @@ -145,7 +145,7 @@ fn main() { `&(3, 5)` 会匹配模式 `&(x, y)`,因此 `x` 得到了 `3`,`y` 得到了 `5`。 -#### if 和 if let +#### let 和 if let 对于以下代码,编译器会报错: