Skip to content

Commit e70effd

Browse files
committed
made the doc tests small and simple
1 parent ba5b980 commit e70effd

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

library/core/src/iter/traits/iterator.rs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4072,22 +4072,12 @@ pub trait Iterator {
40724072
/// Example:
40734073
/// ```
40744074
/// #![feature(iter_contains)]
4075-
/// assert!(![1i32, 2i32, 3i32].iter().contains(&4i32));
4076-
/// assert!([Some(2i32), Option::<i32>::None].iter().contains(&None));
4077-
/// assert!([Some(2i32), Option::<i32>::None].iter().contains(&Some(2i32)));
4078-
/// assert!(!Vec::<i32>::new().iter().contains(&1i32));
4079-
/// assert!([1i32, 2i32, 2i32, 3i32].iter().contains(&2i32));
4080-
/// #[derive(PartialEq)]
4081-
/// struct Item {
4082-
/// value: i32,
4083-
/// }
4084-
/// assert!([Item { value: 1i32 }, Item { value: 2i32 }].iter().contains(&Item { value: 2i32 }));
4075+
/// assert!([1, 2, 3].iter().contains(&1));
4076+
/// assert!(![1, 2, 3].iter().contains(&4));
4077+
/// // You can check if a String is in a string slice iterator.
40854078
/// assert!(["a", "b", "c"].iter().contains(&"b".to_owned()));
4086-
/// assert!(!["a", "b", "c"].iter().contains(&"d".to_owned()));
4087-
/// assert!(["a", "b", "c"].iter().contains(&"b"));
4088-
/// assert!(!["a", "b", "c"].iter().contains(&"d"));
4079+
/// // You can also check if a String iterator contains a string slice.
40894080
/// assert!(["a".to_owned(), "b".to_owned(), "c".to_owned()].iter().contains(&"b"));
4090-
/// assert!(!["a".to_owned(), "b".to_owned(), "c".to_owned()].iter().contains(&"d"));
40914081
/// ```
40924082
///
40934083
#[unstable(feature = "iter_contains", reason = "new API", issue = "127494")]

0 commit comments

Comments
 (0)