mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-04 19:29:07 +00:00
Simplify types in std::option
doc comment example.
This commit is contained in:
parent
b16c7a235f
commit
7b94d6cf19
@ -66,14 +66,14 @@
|
|||||||
//! not ([`None`]).
|
//! not ([`None`]).
|
||||||
//!
|
//!
|
||||||
//! ```
|
//! ```
|
||||||
//! let optional: Option<Box<i32>> = None;
|
//! let optional = None;
|
||||||
//! check_optional(&optional);
|
//! check_optional(optional);
|
||||||
//!
|
//!
|
||||||
//! let optional: Option<Box<i32>> = Some(Box::new(9000));
|
//! let optional = Some(Box::new(9000));
|
||||||
//! check_optional(&optional);
|
//! check_optional(optional);
|
||||||
//!
|
//!
|
||||||
//! fn check_optional(optional: &Option<Box<i32>>) {
|
//! fn check_optional(optional: Option<Box<i32>>) {
|
||||||
//! match *optional {
|
//! match optional {
|
||||||
//! Some(ref p) => println!("has value {}", p),
|
//! Some(ref p) => println!("has value {}", p),
|
||||||
//! None => println!("has no value"),
|
//! None => println!("has no value"),
|
||||||
//! }
|
//! }
|
||||||
|
Loading…
Reference in New Issue
Block a user