Skip to content

Commit

Permalink
Improve some Option code example
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Mar 24, 2016
1 parent 43843d0 commit b922d1a
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/libcore/option.rs
Expand Up @@ -93,16 +93,12 @@
//! let msg = Some("howdy");
//!
//! // Take a reference to the contained string
//! match msg {
//! Some(ref m) => println!("{}", *m),
//! None => (),
//! if let Some(ref m) = msg {
//! println!("{}", *m);
//! }
//!
//! // Remove the contained string, destroying the Option
//! let unwrapped_msg = match msg {
//! Some(m) => m,
//! None => "default message",
//! };
//! let unwrapped_msg = msg.unwrap_or("default message");
//! ```
//!
//! Initialize a result to `None` before a loop:
Expand Down

0 comments on commit b922d1a

Please sign in to comment.