about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPrajwal S N <prajwalnadig21@gmail.com>2024-12-08 18:21:15 +0530
committerGitHub <noreply@github.com>2024-12-08 18:21:15 +0530
commit477b722fe1126ce3aa61757687b8685f1cf9b43f (patch)
treef92a3293a3c381f56c3f35ed66d1a42d6e12b9b6
parentf415c07494b98e4559e4b13a9c5f867b0e6b2444 (diff)
downloadrust-477b722fe1126ce3aa61757687b8685f1cf9b43f.tar.gz
rust-477b722fe1126ce3aa61757687b8685f1cf9b43f.zip
docs: better examples for `std::ops::ControlFlow`
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
-rw-r--r--library/core/src/ops/control_flow.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/library/core/src/ops/control_flow.rs b/library/core/src/ops/control_flow.rs
index c4429b3cd7d..c8fcee5c140 100644
--- a/library/core/src/ops/control_flow.rs
+++ b/library/core/src/ops/control_flow.rs
@@ -141,8 +141,8 @@ impl<B, C> ControlFlow<B, C> {
     /// ```
     /// use std::ops::ControlFlow;
     ///
-    /// assert!(ControlFlow::<i32, String>::Break(3).is_break());
-    /// assert!(!ControlFlow::<String, i32>::Continue(3).is_break());
+    /// assert!(ControlFlow::<&str, i32>::Break("Stop right there!").is_break());
+    /// assert!(!ControlFlow::<&str, i32>::Continue(3).is_break());
     /// ```
     #[inline]
     #[stable(feature = "control_flow_enum_is", since = "1.59.0")]
@@ -157,8 +157,8 @@ impl<B, C> ControlFlow<B, C> {
     /// ```
     /// use std::ops::ControlFlow;
     ///
-    /// assert!(!ControlFlow::<i32, String>::Break(3).is_continue());
-    /// assert!(ControlFlow::<String, i32>::Continue(3).is_continue());
+    /// assert!(!ControlFlow::<&str, i32>::Break("Stop right there!").is_continue());
+    /// assert!(ControlFlow::<&str, i32>::Continue(3).is_continue());
     /// ```
     #[inline]
     #[stable(feature = "control_flow_enum_is", since = "1.59.0")]
@@ -174,8 +174,8 @@ impl<B, C> ControlFlow<B, C> {
     /// ```
     /// use std::ops::ControlFlow;
     ///
-    /// assert_eq!(ControlFlow::<i32, String>::Break(3).break_value(), Some(3));
-    /// assert_eq!(ControlFlow::<String, i32>::Continue(3).break_value(), None);
+    /// assert_eq!(ControlFlow::<&str, i32>::Break("Stop right there!").break_value(), Some("Stop right there!"));
+    /// assert_eq!(ControlFlow::<&str, i32>::Continue(3).break_value(), None);
     /// ```
     #[inline]
     #[stable(feature = "control_flow_enum", since = "1.83.0")]
@@ -205,8 +205,8 @@ impl<B, C> ControlFlow<B, C> {
     /// ```
     /// use std::ops::ControlFlow;
     ///
-    /// assert_eq!(ControlFlow::<i32, String>::Break(3).continue_value(), None);
-    /// assert_eq!(ControlFlow::<String, i32>::Continue(3).continue_value(), Some(3));
+    /// assert_eq!(ControlFlow::<&str, i32>::Break("Stop right there!").continue_value(), None);
+    /// assert_eq!(ControlFlow::<&str, i32>::Continue(3).continue_value(), Some(3));
     /// ```
     #[inline]
     #[stable(feature = "control_flow_enum", since = "1.83.0")]