diff options
| author | bors <bors@rust-lang.org> | 2020-02-28 02:19:31 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-02-28 02:19:31 +0000 |
| commit | 7497d93ef17d2b87fa8efb5c5de33f0bdc4155af (patch) | |
| tree | 8d57b787b10803b869d56281c9aab8f7350525aa /src/libcore | |
| parent | fbc46b7d71d0fe93066d7c026eccd01c16185cd4 (diff) | |
| parent | 02b96b3ecc48dc5245e425fc248163cfaae9643e (diff) | |
| download | rust-7497d93ef17d2b87fa8efb5c5de33f0bdc4155af.tar.gz rust-7497d93ef17d2b87fa8efb5c5de33f0bdc4155af.zip | |
Auto merge of #69534 - Dylan-DPC:rollup-fwa2lip, r=Dylan-DPC
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
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/iter/traits/iterator.rs | 4 | ||||
| -rw-r--r-- | src/libcore/str/pattern.rs | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/libcore/iter/traits/iterator.rs b/src/libcore/iter/traits/iterator.rs index 1d055676c77..6a529bfc8df 100644 --- a/src/libcore/iter/traits/iterator.rs +++ b/src/libcore/iter/traits/iterator.rs @@ -719,6 +719,8 @@ pub trait Iterator { /// ``` /// /// of these layers. + /// + /// Note that `iter.filter(f).next()` is equivalent to `iter.find(f)`. #[inline] #[stable(feature = "rust1", since = "1.0.0")] fn filter<P>(self, predicate: P) -> Filter<Self, P> @@ -2152,6 +2154,8 @@ pub trait Iterator { /// // we can still use `iter`, as there are more elements. /// assert_eq!(iter.next(), Some(&3)); /// ``` + /// + /// Note that `iter.find(f)` is equivalent to `iter.filter(f).next()`. #[inline] #[stable(feature = "rust1", since = "1.0.0")] fn find<P>(&mut self, predicate: P) -> Option<Self::Item> diff --git a/src/libcore/str/pattern.rs b/src/libcore/str/pattern.rs index ef64d8b0fdf..6c826e5dcde 100644 --- a/src/libcore/str/pattern.rs +++ b/src/libcore/str/pattern.rs @@ -1050,7 +1050,7 @@ impl TwoWaySearcher { // &v[..period]. If it is, we use "Algorithm CP1". Otherwise we use // "Algorithm CP2", which is optimized for when the period of the needle // is large. - if &needle[..crit_pos] == &needle[period..period + crit_pos] { + if needle[..crit_pos] == needle[period..period + crit_pos] { // short period case -- the period is exact // compute a separate critical factorization for the reversed needle // x = u' v' where |v'| < period(x). |
