Skip to content

Commit 7146f37

Browse files
committed
Reorder the parameter descriptions of map_or and map_or_else
They were described backwards. rust-lang#84608
1 parent 0686286 commit 7146f37

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

core/src/option.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -489,8 +489,8 @@ impl<T> Option<T> {
489489
}
490490
}
491491

492-
/// Applies a function to the contained value (if any),
493-
/// or returns the provided default (if not).
492+
/// Returns the provided default result (if none),
493+
/// or applies a function to the contained value (if any).
494494
///
495495
/// Arguments passed to `map_or` are eagerly evaluated; if you are passing
496496
/// the result of a function call, it is recommended to use [`map_or_else`],
@@ -516,8 +516,8 @@ impl<T> Option<T> {
516516
}
517517
}
518518

519-
/// Applies a function to the contained value (if any),
520-
/// or computes a default (if not).
519+
/// Computes a default function result (if none), or
520+
/// applies a different function to the contained value (if any).
521521
///
522522
/// # Examples
523523
///

core/src/result.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -506,8 +506,8 @@ impl<T, E> Result<T, E> {
506506
}
507507
}
508508

509-
/// Applies a function to the contained value (if [`Ok`]),
510-
/// or returns the provided default (if [`Err`]).
509+
/// Returns the provided default (if [`Err`]), or
510+
/// applies a function to the contained value (if [`Ok`]),
511511
///
512512
/// Arguments passed to `map_or` are eagerly evaluated; if you are passing
513513
/// the result of a function call, it is recommended to use [`map_or_else`],
@@ -533,9 +533,9 @@ impl<T, E> Result<T, E> {
533533
}
534534
}
535535

536-
/// Maps a `Result<T, E>` to `U` by applying a function to a
537-
/// contained [`Ok`] value, or a fallback function to a
538-
/// contained [`Err`] value.
536+
/// Maps a `Result<T, E>` to `U` by applying a fallback function to a
537+
/// contained [`Err`] value, or a default function to a
538+
/// contained [`Ok`] value.
539539
///
540540
/// This function can be used to unpack a successful result
541541
/// while handling an error.

0 commit comments

Comments
 (0)