From 9d0542b76d801b09097a56a2bacce0acf60c849d Mon Sep 17 00:00:00 2001 From: Adam-Gleave Date: Thu, 1 Sep 2022 16:09:25 +0100 Subject: [PATCH 1/2] Document eager evaluation of `bool::then_some` argument --- library/core/src/bool.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/library/core/src/bool.rs b/library/core/src/bool.rs index f7a8aa0d92156..267d787483d5a 100644 --- a/library/core/src/bool.rs +++ b/library/core/src/bool.rs @@ -6,6 +6,12 @@ impl bool { /// Returns `Some(t)` if the `bool` is [`true`](../std/keyword.true.html), /// or `None` otherwise. /// + /// Arguments passed to `then_some` are eagerly evaluated; if you are + /// passing the result of a function call, it is recommended to use + /// [`then`], which is lazily evaluated. + /// + /// [`then`]: bool::then + /// /// # Examples /// /// ``` From 33afe9724aff279cd6a9fc1cbbdca5aa8a721e30 Mon Sep 17 00:00:00 2001 From: Adam-Gleave Date: Thu, 1 Sep 2022 17:32:00 +0100 Subject: [PATCH 2/2] Remove trailing whitespace --- library/core/src/bool.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/library/core/src/bool.rs b/library/core/src/bool.rs index 267d787483d5a..7667a65083769 100644 --- a/library/core/src/bool.rs +++ b/library/core/src/bool.rs @@ -6,12 +6,12 @@ impl bool { /// Returns `Some(t)` if the `bool` is [`true`](../std/keyword.true.html), /// or `None` otherwise. /// - /// Arguments passed to `then_some` are eagerly evaluated; if you are - /// passing the result of a function call, it is recommended to use + /// Arguments passed to `then_some` are eagerly evaluated; if you are + /// passing the result of a function call, it is recommended to use /// [`then`], which is lazily evaluated. - /// + /// /// [`then`]: bool::then - /// + /// /// # Examples /// /// ```