Skip to content

Commit 0291b6a

Browse files
authored
Rollup merge of #69501 - matthiaskrgr:find_note, r=ecstatic-morse
note that find(f) is equivalent to filter(f).next() in the docs. r? @ecstatic-morse
2 parents 5b32dd0 + 31b9764 commit 0291b6a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Diff for: src/libcore/iter/traits/iterator.rs

+4
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,8 @@ pub trait Iterator {
719719
/// ```
720720
///
721721
/// of these layers.
722+
///
723+
/// Note that `iter.filter(f).next()` is equivalent to `iter.find(f)`.
722724
#[inline]
723725
#[stable(feature = "rust1", since = "1.0.0")]
724726
fn filter<P>(self, predicate: P) -> Filter<Self, P>
@@ -2152,6 +2154,8 @@ pub trait Iterator {
21522154
/// // we can still use `iter`, as there are more elements.
21532155
/// assert_eq!(iter.next(), Some(&3));
21542156
/// ```
2157+
///
2158+
/// Note that `iter.find(f)` is equivalent to `iter.filter(f).next()`.
21552159
#[inline]
21562160
#[stable(feature = "rust1", since = "1.0.0")]
21572161
fn find<P>(&mut self, predicate: P) -> Option<Self::Item>

0 commit comments

Comments
 (0)