Skip to content

Commit 8f63e8d

Browse files
huntiepnikomatsakis
authored andcommitted
Add docs for Missing, correct Option's Try test
1 parent f098d7b commit 8f63e8d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/libcore/option.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1124,7 +1124,7 @@ impl<A, V: FromIterator<A>> FromIterator<Option<A>> for Option<V> {
11241124
}
11251125
}
11261126

1127-
/// The `Option` type. See [the module level documentation](index.html) for more.
1127+
/// The equivalent of `Option::None` for a `Result::Err`.
11281128
#[unstable(feature = "try_trait", issue = "42327")]
11291129
#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)]
11301130
pub struct Missing;

src/libcore/tests/option.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -286,13 +286,13 @@ fn test_try() {
286286
assert_eq!(try_option_none(), None);
287287

288288
fn try_option_ok() -> Result<u8, Missing> {
289-
let val = Ok(1)?;
289+
let val = Some(1)?;
290290
Ok(val)
291291
}
292292
assert_eq!(try_option_ok(), Ok(1));
293293

294294
fn try_option_err() -> Result<u8, Missing> {
295-
let val = Err(Missing)?;
295+
let val = None?;
296296
Ok(val)
297297
}
298298
assert_eq!(try_option_err(), Err(Missing));

0 commit comments

Comments
 (0)