Skip to content

Commit 8a64b9d

Browse files
snprajwalgitbot
authored and
gitbot
committed
docs: better examples for std::ops::ControlFlow
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
1 parent f898db3 commit 8a64b9d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

core/src/ops/control_flow.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ impl<B, C> ControlFlow<B, C> {
141141
/// ```
142142
/// use std::ops::ControlFlow;
143143
///
144-
/// assert!(ControlFlow::<i32, String>::Break(3).is_break());
145-
/// assert!(!ControlFlow::<String, i32>::Continue(3).is_break());
144+
/// assert!(ControlFlow::<&str, i32>::Break("Stop right there!").is_break());
145+
/// assert!(!ControlFlow::<&str, i32>::Continue(3).is_break());
146146
/// ```
147147
#[inline]
148148
#[stable(feature = "control_flow_enum_is", since = "1.59.0")]
@@ -157,8 +157,8 @@ impl<B, C> ControlFlow<B, C> {
157157
/// ```
158158
/// use std::ops::ControlFlow;
159159
///
160-
/// assert!(!ControlFlow::<i32, String>::Break(3).is_continue());
161-
/// assert!(ControlFlow::<String, i32>::Continue(3).is_continue());
160+
/// assert!(!ControlFlow::<&str, i32>::Break("Stop right there!").is_continue());
161+
/// assert!(ControlFlow::<&str, i32>::Continue(3).is_continue());
162162
/// ```
163163
#[inline]
164164
#[stable(feature = "control_flow_enum_is", since = "1.59.0")]
@@ -174,8 +174,8 @@ impl<B, C> ControlFlow<B, C> {
174174
/// ```
175175
/// use std::ops::ControlFlow;
176176
///
177-
/// assert_eq!(ControlFlow::<i32, String>::Break(3).break_value(), Some(3));
178-
/// assert_eq!(ControlFlow::<String, i32>::Continue(3).break_value(), None);
177+
/// assert_eq!(ControlFlow::<&str, i32>::Break("Stop right there!").break_value(), Some("Stop right there!"));
178+
/// assert_eq!(ControlFlow::<&str, i32>::Continue(3).break_value(), None);
179179
/// ```
180180
#[inline]
181181
#[stable(feature = "control_flow_enum", since = "1.83.0")]
@@ -205,8 +205,8 @@ impl<B, C> ControlFlow<B, C> {
205205
/// ```
206206
/// use std::ops::ControlFlow;
207207
///
208-
/// assert_eq!(ControlFlow::<i32, String>::Break(3).continue_value(), None);
209-
/// assert_eq!(ControlFlow::<String, i32>::Continue(3).continue_value(), Some(3));
208+
/// assert_eq!(ControlFlow::<&str, i32>::Break("Stop right there!").continue_value(), None);
209+
/// assert_eq!(ControlFlow::<&str, i32>::Continue(3).continue_value(), Some(3));
210210
/// ```
211211
#[inline]
212212
#[stable(feature = "control_flow_enum", since = "1.83.0")]

0 commit comments

Comments
 (0)