-
Notifications
You must be signed in to change notification settings - Fork 898
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
Avoid two allocations #6326
Avoid two allocations #6326
Conversation
@@ -2,7 +2,7 @@ | |||
|
|||
use std::{borrow::Cow, iter}; | |||
|
|||
use itertools::{MultiPeek, multipeek}; | |||
use itertools::{Itertools as _, MultiPeek, multipeek}; |
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.
Could you explain why you're brining Itertools
into scope?
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.
It is used for the Itertools::join
on line 1077.
.collect(); | ||
lines.join(&format!("\n{}", offset.to_string(config))) | ||
.join(&format!("\n{}", offset.to_string(config))) |
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.
Okay, so just want to make sure I'm understanding this correctly. This avoids allocating the Vec<&str>
and directly allocates into a String
?
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.
Yes, exactly.
f7205e7
to
96dbcc3
Compare
No description provided.