about summary refs log tree commit diff
path: root/src/libcore/iter/iterator.rs
AgeCommit message (Collapse)AuthorLines
2019-01-22Move core::iter iterator.rs to traits moduleClar Fon-2738/+0
2019-01-17Compare pairs with `slice::windows`Kevin Leimkuhler-1/+4
2019-01-17Improve documentation and slice implKevin Leimkuhler-2/+6
2019-01-17Add is_sorted unstable documentationKevin Leimkuhler-0/+2
2019-01-17Add is_sorted impl for [T]Kevin Leimkuhler-20/+16
2019-01-17Add initial impl of is_sorted to IteratorKevin Leimkuhler-0/+84
2019-01-14Simplify 'product' factorial exampletimvisee-1/+1
2019-01-13Change #[must_use] message of IteratorTaiki Endo-1/+1
2019-01-13Add #[must_use] message to Iterator and FutureTaiki Endo-1/+1
2018-12-26Auto merge of #56534 - xfix:copied, r=@SimonSapinbors-1/+30
Add unstable Iterator::copied() Initially suggested at https://github.com/bluss/rust-itertools/pull/289, however the maintainers of itertools suggested this may be better of in a standard library. The intent of `copied` is to avoid accidentally cloning iterator elements after doing a code refactoring which causes a structure to be no longer `Copy`. This is a relatively common pattern, as it can be seen by calling `rg --pcre2 '[.]map[(][|](?:(\w+)[|] [*]\1|&(\w+)[|] \2)[)]'` on Rust main repository. Additionally, many uses of `cloned` actually want to simply `Copy`, and changing something to be no longer copyable may introduce unnoticeable performance penalty. Also, this makes sense because the standard library includes `[T].copy_from_slice` to pair with `[T].clone_from_slice`. This also adds `Option::copied`, because it makes sense to pair it with `Iterator::copied`. I don't think this feature is particularly important, but it makes sense to update `Option` along with `Iterator` for consistency.
2018-12-26Add a tracking issue for Iterator::copiedKonrad Borowski-1/+1
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-24Rollup merge of #56242 - GuillaumeGomez:iterator-missing-link, r=CentrilMazdak Farrokhzad-1/+1
Add missing link in docs r? @steveklabnik
2018-12-23Merge branch 'master' into copiedKonrad Borowski-2/+3
2018-12-17Fix grammar in compiler error for array iteratorsMatthew Russell-1/+1
2018-12-10Add #[must_use] attribute to stdlib traitsFelix Chapman-0/+1
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-1/+1
2018-12-05Add unstable Iterator::copied()Konrad Borowski-1/+30
2018-11-27Add missing doc linkGuillaume Gomez-1/+2
2018-11-26Add missing link in docsGuillaume Gomez-1/+1
2018-11-20fix more linksSteve Klabnik-3/+3
2018-10-26Remove unnecessary mut in iterator.find_map documentation example, Relates ↵Méven Car-1/+1
to #49098
2018-10-11Reword Range*/[Range*]: Iterator E0277 messagesEsteban Küber-6/+22
2018-10-11review commentsEsteban Küber-4/+28
- reword messages - apply custom comments to all types of ranges - fix indentation
2018-10-09fix tidyEsteban Küber-2/+4
2018-10-09Reword `rustc_on_unimplemented` errors for `Iterator`Esteban Küber-1/+20
- Detect one element array of `Range` type, which is potentially a typo: `for _ in [0..10] {}` where iterating between `0` and `10` was intended. (#23141) - Suggest `.bytes()` and `.chars()` for `String`. - Suggest borrowing or `.iter()` on arrays (#36391) - Suggest using range literal when iterating on integers (#34353) - Do not suggest `.iter()` by default (#50773, #46806)
2018-09-29Use impl_header_lifetime_elision in libcoreScott McMurray-1/+1
2018-08-25Auto merge of #53385 - matklad:stabilize-find-map, r=KodrAusbors-4/+1
Stablize Iterator::find_map Stabilization PR for https://github.com/rust-lang/rust/issues/49602
2018-08-15Fix since of Iterator::flatten to be a proper semverAleksey Kladov-1/+1
2018-08-15Stablize Iterator::find_mapAleksey Kladov-4/+1
2018-08-04Remove redundant field names in structsljedrz-9/+9
2018-07-25Enforce #![deny(bare_trait_objects)] in src/libcoreljedrz-1/+1
2018-07-17Clarify short-circuiting behvaior of Iterator::zip.Corey Farwell-1/+3
Fixes https://github.com/rust-lang/rust/issues/52279.
2018-07-10step_by: leave time of item skip unspecifiedEmerentius-1/+22
this gives us some leeway when optimizing
2018-07-01Rollup merge of #51511 - Centril:feature/stabilize_iterator_flatten, ↵Pietro Albini-7/+1
r=SimonSapin Stabilize Iterator::flatten in 1.29, fixes #48213. This PR stabilizes [`Iterator::flatten`](https://doc.rust-lang.org/nightly/std/iter/trait.Iterator.html#method.flatten) in *version 1.29* (1.28 goes to beta in 10 days, I don't think there's enough time to land it in that time, but let's see...). Tracking issue is: #48213. cc @bluss re. itertools. r? @SimonSapin ping @pietroalbini -- let's do a crater run when this passes CI :)
2018-06-13Replace `core::iter::AlwaysOk<T>` by `Result<T, !>`kennytm-2/+2
2018-06-11stabilize Iterator::flatten in 1.29, fixes #48115.Mazdak Farrokhzad-7/+1
2018-06-02Stabilize Iterator::step_byThayne McCombs-4/+1
Fixes #27741
2018-05-28Document additional use case for iter::inspectNick Babcock-2/+29
2018-05-13Fix incorrect statement about return value for Iterator::zip.Corey Farwell-2/+1
Fixes https://github.com/rust-lang/rust/issues/50225.
2018-04-29Fix some broken links in docs.Eric Huss-0/+2
2018-04-16Remove unwanted auto-linking and updateGuillaume Gomez-1/+1
2018-04-04Rollup merge of #49607 - cuviper:stable-iter-1.27, r=alexcrichtonkennytm-5/+2
Stabilize iterator methods in 1.27 - Closes #39480, feature `iter_rfind` - `DoubleEndedIterator::rfind` - Closes #44705, feature `iter_rfold` - `DoubleEndedIterator::rfold` - Closes #45594, feature `iterator_try_fold` - `Iterator::try_fold` - `Iterator::try_for_each` - `DoubleEndedIterator::try_rfold`
2018-04-04Rollup merge of #49533 - scottmcm:more-must-use, r=nikomatsakiskennytm-0/+1
Add #[must_use] to a few standard library methods Chosen to start a precedent of using it on ones that are potentially-expensive and where using it for side effects is particularly discouraged. Discuss :) ```rust warning: unused return value of `std::iter::Iterator::collect` which must be used: if you really need to exhaust the iterator, consider `.for_each(drop)` instead --> $DIR/fn_must_use_stdlib.rs:19:5 | LL | "1 2 3".split_whitespace().collect::<Vec<_>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused return value of `std::borrow::ToOwned::to_owned` which must be used: cloning is often expensive and is not expected to have side effects --> $DIR/fn_must_use_stdlib.rs:21:5 | LL | "hello".to_owned(); | ^^^^^^^^^^^^^^^^^^^ warning: unused return value of `std::clone::Clone::clone` which must be used: cloning is often expensive and is not expected to have side effects --> $DIR/fn_must_use_stdlib.rs:23:5 | LL | String::from("world").clone(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ``` cc https://github.com/rust-lang/rust/issues/48926
2018-04-02Stabilize iterator_try_fold in 1.27.0Josh Stone-5/+2
2018-04-03Add Iterator::find_mapAleksey Kladov-0/+32
2018-03-30Add #[must_use] to a few standard library methodsScott McMurray-0/+1
Chosen to start a precedent of using it on ones that are potentially-expensive and where using it for side effects is particularly discouraged. Discuss :)
2018-03-24Fix confusing doc for `scan`Sean Silva-5/+5
The comment "the value passed on to the next iteration" confused me since it sounded more like what Haskell's [scanl](http://hackage.haskell.org/package/base-4.11.0.0/docs/Prelude.html#v:scanl) does where the closure's return value serves as both the "yielded value" *and* the new value of the "state". I tried changing the example to make it clear that the closure's return value is decoupled from the state argument.
2018-03-06Rollup merge of #48590 - tshepang:more-simple, r=frewsxcvkennytm-31/+22
doc: no need for the reference Also, we are well within line length limit
2018-02-28doc: no need for the referencesTshepang Lekhonkhobe-31/+22
Also: - apply some rustfmt love - fix output of one example