-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
note that find(f) is equivalent to filter(f).next() in the docs. #69501
Conversation
src/libcore/iter/traits/iterator.rs
Outdated
@@ -2119,6 +2119,7 @@ pub trait Iterator { | |||
/// | |||
/// `find()` is short-circuiting; in other words, it will stop processing | |||
/// as soon as the closure returns `true`. | |||
/// `iter.find(f)` is equivalent to `iter.filter(f).next()`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this go in its own paragraph near the end? It's not really related to the short-circuiting.
9746ae9
to
5098188
Compare
src/libcore/iter/traits/iterator.rs
Outdated
@@ -2120,6 +2120,8 @@ pub trait Iterator { | |||
/// `find()` is short-circuiting; in other words, it will stop processing | |||
/// as soon as the closure returns `true`. | |||
/// | |||
/// `iter.find(f)` is equivalent to `iter.filter(f).next()`. |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
Another thought: Let's rephrase the sentence:
and move it to |
5098188
to
31b9764
Compare
@bors r=ecstatic-morse rollup |
📌 Commit 31b9764 has been approved by |
Rollup of 9 pull requests Successful merges: - #69379 (Fail on multiple declarations of `main`.) - #69430 (librustc_typeck: remove loop that never actually loops) - #69449 (Do not ping PR reviewers in toolstate breakage) - #69491 (rustc_span: Add `Symbol::to_ident_string` for use in diagnostic messages) - #69495 (don't take redundant references to operands) - #69496 (use find(x) instead of filter(x).next()) - #69501 (note that find(f) is equivalent to filter(f).next() in the docs.) - #69527 (Ignore untracked paths when running `rustfmt` on repository.) - #69529 (don't use .into() to convert types into identical types.) Failed merges: r? @ghost
r? @ecstatic-morse