From 6c22b39187b25d0c2b07e1d85b93107c409a1c41 Mon Sep 17 00:00:00 2001 From: Dan Zwell Date: Tue, 27 Apr 2021 17:58:54 +0800 Subject: [PATCH] Reorder the parameter descriptions of map_or and map_or_else They were described backwards. #84608 --- library/core/src/option.rs | 8 ++++---- library/core/src/result.rs | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/library/core/src/option.rs b/library/core/src/option.rs index 9c527eff4916f..04551dded8c77 100644 --- a/library/core/src/option.rs +++ b/library/core/src/option.rs @@ -489,8 +489,8 @@ impl Option { } } - /// Applies a function to the contained value (if any), - /// or returns the provided default (if not). + /// Returns the provided default result (if none), + /// or applies a function to the contained value (if any). /// /// Arguments passed to `map_or` are eagerly evaluated; if you are passing /// the result of a function call, it is recommended to use [`map_or_else`], @@ -516,8 +516,8 @@ impl Option { } } - /// Applies a function to the contained value (if any), - /// or computes a default (if not). + /// Computes a default function result (if none), or + /// applies a different function to the contained value (if any). /// /// # Examples /// diff --git a/library/core/src/result.rs b/library/core/src/result.rs index bac02104c3488..e0071f806aaaf 100644 --- a/library/core/src/result.rs +++ b/library/core/src/result.rs @@ -506,8 +506,8 @@ impl Result { } } - /// Applies a function to the contained value (if [`Ok`]), - /// or returns the provided default (if [`Err`]). + /// Returns the provided default (if [`Err`]), or + /// applies a function to the contained value (if [`Ok`]), /// /// Arguments passed to `map_or` are eagerly evaluated; if you are passing /// the result of a function call, it is recommended to use [`map_or_else`], @@ -533,9 +533,9 @@ impl Result { } } - /// Maps a `Result` to `U` by applying a function to a - /// contained [`Ok`] value, or a fallback function to a - /// contained [`Err`] value. + /// Maps a `Result` to `U` by applying a fallback function to a + /// contained [`Err`] value, or a default function to a + /// contained [`Ok`] value. /// /// This function can be used to unpack a successful result /// while handling an error.