-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't collect to vectors where unnecessary #55048
Conversation
r? @cramertj (rust_highfive has picked a reviewer for you, use r? to override) |
src/librustc_traits/lowering.rs
Outdated
.iter() | ||
.cloned() | ||
|
||
.clone() |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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)?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
@bors r+ |
📌 Commit 12b5c7b has been approved by |
Don't collect to vectors where unnecessary This removes 3 vector allocations and a call to `cloned()`.
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
This removes 3 vector allocations and a call to
cloned()
.