{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/56534","repository_url":"https://api.github.com/repos/rust-lang/rust","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/56534/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/56534/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/56534/events","html_url":"https://github.com/rust-lang/rust/pull/56534","id":387764475,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM2MTgwMDIz","number":56534,"title":"Add unstable Iterator::copied()","user":{"login":"xfix","id":1297598,"node_id":"MDQ6VXNlcjEyOTc1OTg=","avatar_url":"https://avatars2.githubusercontent.com/u/1297598?v=4","gravatar_id":"","url":"https://api.github.com/users/xfix","html_url":"https://github.com/xfix","followers_url":"https://api.github.com/users/xfix/followers","following_url":"https://api.github.com/users/xfix/following{/other_user}","gists_url":"https://api.github.com/users/xfix/gists{/gist_id}","starred_url":"https://api.github.com/users/xfix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xfix/subscriptions","organizations_url":"https://api.github.com/users/xfix/orgs","repos_url":"https://api.github.com/users/xfix/repos","events_url":"https://api.github.com/users/xfix/events{/privacy}","received_events_url":"https://api.github.com/users/xfix/received_events","type":"User","site_admin":false},"labels":[{"id":583437191,"node_id":"MDU6TGFiZWw1ODM0MzcxOTE=","url":"https://api.github.com/repos/rust-lang/rust/labels/S-waiting-on-bors","name":"S-waiting-on-bors","color":"d3dddd","default":false},{"id":211668062,"node_id":"MDU6TGFiZWwyMTE2NjgwNjI=","url":"https://api.github.com/repos/rust-lang/rust/labels/T-libs","name":"T-libs","color":"bfd4f2","default":false}],"state":"open","locked":false,"assignee":{"login":"SimonSapin","id":291359,"node_id":"MDQ6VXNlcjI5MTM1OQ==","avatar_url":"https://avatars0.githubusercontent.com/u/291359?v=4","gravatar_id":"","url":"https://api.github.com/users/SimonSapin","html_url":"https://github.com/SimonSapin","followers_url":"https://api.github.com/users/SimonSapin/followers","following_url":"https://api.github.com/users/SimonSapin/following{/other_user}","gists_url":"https://api.github.com/users/SimonSapin/gists{/gist_id}","starred_url":"https://api.github.com/users/SimonSapin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimonSapin/subscriptions","organizations_url":"https://api.github.com/users/SimonSapin/orgs","repos_url":"https://api.github.com/users/SimonSapin/repos","events_url":"https://api.github.com/users/SimonSapin/events{/privacy}","received_events_url":"https://api.github.com/users/SimonSapin/received_events","type":"User","site_admin":false},"assignees":[{"login":"SimonSapin","id":291359,"node_id":"MDQ6VXNlcjI5MTM1OQ==","avatar_url":"https://avatars0.githubusercontent.com/u/291359?v=4","gravatar_id":"","url":"https://api.github.com/users/SimonSapin","html_url":"https://github.com/SimonSapin","followers_url":"https://api.github.com/users/SimonSapin/followers","following_url":"https://api.github.com/users/SimonSapin/following{/other_user}","gists_url":"https://api.github.com/users/SimonSapin/gists{/gist_id}","starred_url":"https://api.github.com/users/SimonSapin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimonSapin/subscriptions","organizations_url":"https://api.github.com/users/SimonSapin/orgs","repos_url":"https://api.github.com/users/SimonSapin/repos","events_url":"https://api.github.com/users/SimonSapin/events{/privacy}","received_events_url":"https://api.github.com/users/SimonSapin/received_events","type":"User","site_admin":false}],"milestone":null,"comments":14,"created_at":"2018-12-05T13:47:27Z","updated_at":"2018-12-26T22:19:34Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/56534","html_url":"https://github.com/rust-lang/rust/pull/56534","diff_url":"https://github.com/rust-lang/rust/pull/56534.diff","patch_url":"https://github.com/rust-lang/rust/pull/56534.patch"},"body":"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.\r\n\r\nThe 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.\r\n\r\nAlso, this makes sense because the standard library includes `[T].copy_from_slice` to pair with `[T].clone_from_slice`.\r\n\r\nThis 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."},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/450034429","html_url":"https://github.com/rust-lang/rust/pull/56534#issuecomment-450034429","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/56534","id":450034429,"node_id":"MDEyOklzc3VlQ29tbWVudDQ1MDAzNDQyOQ==","user":{"login":"bors","id":3372342,"node_id":"MDQ6VXNlcjMzNzIzNDI=","avatar_url":"https://avatars2.githubusercontent.com/u/3372342?v=4","gravatar_id":"","url":"https://api.github.com/users/bors","html_url":"https://github.com/bors","followers_url":"https://api.github.com/users/bors/followers","following_url":"https://api.github.com/users/bors/following{/other_user}","gists_url":"https://api.github.com/users/bors/gists{/gist_id}","starred_url":"https://api.github.com/users/bors/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bors/subscriptions","organizations_url":"https://api.github.com/users/bors/orgs","repos_url":"https://api.github.com/users/bors/repos","events_url":"https://api.github.com/users/bors/events{/privacy}","received_events_url":"https://api.github.com/users/bors/received_events","type":"User","site_admin":false},"created_at":"2018-12-26T22:19:34Z","updated_at":"2018-12-26T22:19:34Z","author_association":"CONTRIBUTOR","body":":sunny: Test successful - [status-appveyor](https://ci.appveyor.com/project/rust-lang/rust/builds/21240400), [status-travis](https://travis-ci.org/rust-lang/rust/builds/472429234?utm_source=github_status&utm_medium=notification)\nApproved by: @SimonSapin\nPushing a7be40c65ae8ace467c9c40b0a22642973e31a13 to master..."}}
{"actor":{"display_login":"bors"}}