Update option.rs

I updated the example of the `expect` examples so they won't contain depressing sentences any more !
This commit is contained in:
Marincia Catalin 2020-02-01 19:05:50 +02:00 committed by GitHub
parent 6c0b779b7b
commit 2ce14b8a19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -331,12 +331,12 @@ impl<T> Option<T> {
///
/// ```
/// let x = Some("value");
/// assert_eq!(x.expect("the world is ending"), "value");
/// assert_eq!(x.expect("fruits are healthy"), "value");
/// ```
///
/// ```{.should_panic}
/// let x: Option<&str> = None;
/// x.expect("the world is ending"); // panics with `the world is ending`
/// x.expect("fruits are healthy"); // panics with `fruits are healthy`
/// ```
#[inline]
#[track_caller]