From 081fe300e7f9474d1c3cdf64e4c552b63dada607 Mon Sep 17 00:00:00 2001 From: chrismit3s Date: Fri, 1 Oct 2021 21:55:35 +0200 Subject: [PATCH 1/2] Add paragraph to ControlFlow docs to menion it works with the ? operator (#88715) --- library/core/src/ops/control_flow.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/library/core/src/ops/control_flow.rs b/library/core/src/ops/control_flow.rs index cd2d57699c92c..d46ed0f84855b 100644 --- a/library/core/src/ops/control_flow.rs +++ b/library/core/src/ops/control_flow.rs @@ -7,6 +7,10 @@ use crate::{convert, ops}; /// Having the enum makes it clearer -- no more wondering "wait, what did `false` /// mean again?" -- and allows including a value. /// +/// Similar to [`Option`] and [`Result`], this enum can be used with the `?` operator +/// to return immediatly if the [`Break`] variant is present or to continue normally +/// with the value inside the [`Continue`] variant. +/// /// # Examples /// /// Early-exiting from [`Iterator::try_for_each`]: @@ -46,6 +50,9 @@ use crate::{convert, ops}; /// } /// } /// ``` +/// +/// [`Break`]: ControlFlow::Break +/// [`Continue`]: ControlFlow::Continue #[stable(feature = "control_flow_enum_type", since = "1.55.0")] #[derive(Debug, Clone, Copy, PartialEq)] pub enum ControlFlow { From 825cd8101835cc7af2036c1a8a5f9febb72f42aa Mon Sep 17 00:00:00 2001 From: Christoph Smithmyer <38911273+chrismit3s@users.noreply.github.com> Date: Sat, 2 Oct 2021 13:16:24 +0200 Subject: [PATCH 2/2] Fix typo and change a word in ControlFlow docs Co-authored-by: r00ster --- library/core/src/ops/control_flow.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/core/src/ops/control_flow.rs b/library/core/src/ops/control_flow.rs index d46ed0f84855b..17794eb7ba5ad 100644 --- a/library/core/src/ops/control_flow.rs +++ b/library/core/src/ops/control_flow.rs @@ -8,7 +8,7 @@ use crate::{convert, ops}; /// mean again?" -- and allows including a value. /// /// Similar to [`Option`] and [`Result`], this enum can be used with the `?` operator -/// to return immediatly if the [`Break`] variant is present or to continue normally +/// to return immediately if the [`Break`] variant is present or otherwise continue normally /// with the value inside the [`Continue`] variant. /// /// # Examples