We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents bce02a2 + b922d1a commit b2dfb7cCopy full SHA for b2dfb7c
src/libcore/option.rs
@@ -93,16 +93,12 @@
93
//! let msg = Some("howdy");
94
//!
95
//! // Take a reference to the contained string
96
-//! match msg {
97
-//! Some(ref m) => println!("{}", *m),
98
-//! None => (),
+//! if let Some(ref m) = msg {
+//! println!("{}", *m);
99
//! }
100
101
//! // Remove the contained string, destroying the Option
102
-//! let unwrapped_msg = match msg {
103
-//! Some(m) => m,
104
-//! None => "default message",
105
-//! };
+//! let unwrapped_msg = msg.unwrap_or("default message");
106
//! ```
107
108
//! Initialize a result to `None` before a loop:
0 commit comments