Skip to content

Commit 71b16d8

Browse files
committed
Corrected bad typing in Result::map_or_else doc
The error value now includes the type of the success. The success value now includes the type of the error.
1 parent 5eb6791 commit 71b16d8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libcore/result.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -487,10 +487,10 @@ impl<T, E> Result<T, E> {
487487
/// ```
488488
/// let k = 21;
489489
///
490-
/// let x = Ok("foo");
490+
/// let x : Result<_, &str> = Ok("foo");
491491
/// assert_eq!(x.map_or_else(|e| k * 2, |v| v.len()), 3);
492492
///
493-
/// let x = Err("bar");
493+
/// let x : Result<&str, _> = Err("bar");
494494
/// assert_eq!(x.map_or_else(|e| k * 2, |v| v.len()), 42);
495495
/// ```
496496
#[inline]

0 commit comments

Comments
 (0)