diff options
| author | bors <bors@rust-lang.org> | 2018-12-26 19:39:19 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-12-26 19:39:19 +0000 |
| commit | a7be40c65ae8ace467c9c40b0a22642973e31a13 (patch) | |
| tree | 997497091f9aaca0489ac21046023138342a7432 /src/librustdoc/html/static/source-script.js | |
| parent | 79d8a0fcefa5134db2a94739b1d18daa01fc6e9f (diff) | |
| parent | 315401ddf8857c9431a889ac1307dca856e4fe65 (diff) | |
| download | rust-a7be40c65ae8ace467c9c40b0a22642973e31a13.tar.gz rust-a7be40c65ae8ace467c9c40b0a22642973e31a13.zip | |
Auto merge of #56534 - xfix:copied, r=@SimonSapin
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.
Diffstat (limited to 'src/librustdoc/html/static/source-script.js')
0 files changed, 0 insertions, 0 deletions
