diff options
| author | Markus Reiter <me@reitermark.us> | 2024-02-22 16:47:33 +0100 |
|---|---|---|
| committer | Markus Reiter <me@reitermark.us> | 2024-02-22 17:16:29 +0100 |
| commit | b74d8db9d258bbfbfb9d993dce6fbdd8f09dfa31 (patch) | |
| tree | e69017549386b3da4c006f6d1a13bc97108d9e98 | |
| parent | 0c474acdfaba7aea63d0ed28526c670b298b96ba (diff) | |
| download | rust-b74d8db9d258bbfbfb9d993dce6fbdd8f09dfa31.tar.gz rust-b74d8db9d258bbfbfb9d993dce6fbdd8f09dfa31.zip | |
Fix example.
| -rw-r--r-- | library/core/src/iter/traits/iterator.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/library/core/src/iter/traits/iterator.rs b/library/core/src/iter/traits/iterator.rs index 9dd724a7166..3267cea38b7 100644 --- a/library/core/src/iter/traits/iterator.rs +++ b/library/core/src/iter/traits/iterator.rs @@ -2967,12 +2967,13 @@ pub trait Iterator { /// assert!(result.is_err()); /// ``` /// - /// This also supports other types which implement `Try`, not just `Result`. + /// This also supports other types which implement [`Try`], not just [`Result`]. + /// /// ``` /// #![feature(generic_nonzero, try_find)] - /// /// use std::num::NonZero; - /// let a = [3, 5, 7, 4, 9, 0, 11]; + /// + /// let a = [3, 5, 7, 4, 9, 0, 11u32]; /// let result = a.iter().try_find(|&&x| NonZero::new(x).map(|y| y.is_power_of_two())); /// assert_eq!(result, Some(Some(&4))); /// let result = a.iter().take(3).try_find(|&&x| NonZero::new(x).map(|y| y.is_power_of_two())); |
