Skip to content

Conversation

ljedrz
Copy link
Contributor

@ljedrz ljedrz commented Oct 13, 2018

This removes 3 vector allocations and a call to cloned().

@rust-highfive
Copy link
Contributor

r? @cramertj

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 13, 2018
.iter()
.cloned()

.clone()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, isn't this cloning the underlying vector?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought this only clones the Iter struct, i.e. only the start and end pointer (and the marker)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where_clause is an into_iter struct, not an iter struct which is why I think this will copy the vector.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, you're right; luckily, there is still room for improvement - I'll update the PR shortly.

@estebank
Copy link
Contributor

@bors r+

@bors
Copy link
Collaborator

bors commented Oct 15, 2018

📌 Commit 12b5c7b has been approved by estebank

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 15, 2018
Manishearth added a commit to Manishearth/rust that referenced this pull request Oct 15, 2018
Don't collect to vectors where unnecessary

This removes 3 vector allocations and a call to `cloned()`.
bors added a commit that referenced this pull request Oct 15, 2018
Rollup of 11 pull requests

Successful merges:

 - #54820 (Closes #54538: `unused_patterns` lint)
 - #54963 (Cleanup rustc/session)
 - #54991 (add test for #23189)
 - #55025 (Add missing lifetime fragment specifier to error message.)
 - #55047 (doc: make core::fmt::Error example more simple)
 - #55048 (Don't collect to vectors where unnecessary)
 - #55060 (clarify pointer add/sub function safety concerns)
 - #55062 (Make EvalContext::step public again)
 - #55066 (Fix incorrect link in println! documentation)
 - #55081 (Deduplicate tests)
 - #55088 (Update rustc documentation link)

Failed merges:

r? @ghost
@bors bors merged commit 12b5c7b into rust-lang:master Oct 15, 2018
@ljedrz ljedrz deleted the begone_vecc branch October 16, 2018 05:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants