Skip to content

Conversation

Lucretiel
Copy link
Contributor

This PR extends the logic around buffer reuse in FromIterator<String> for String into Extend and a few other FromIterator implementations. Basically, in cases where we're extending from allocated types (String, Cow<str>, Box<str>), we check if self is empty and, if so, just take the incoming value by move rather than copying the data.

Follow up to #56548.

@rust-highfive
Copy link
Contributor

r? @yaahc

(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 Sep 22, 2021
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@joshtriplett
Copy link
Member

Looks reasonable to me. r=me once CI passes and once a perf run confirms that this is either neutral or an improvement.

@Lucretiel
Copy link
Contributor Author

CI is failing on into_string doesn't exist on Box<str> and tbh I don't really understand why, since it's being used in From<Box<str>> for String elsewhere in this file. Something to do with #[cfg(test)]?

@apiraino apiraino added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Oct 14, 2021
@joshtriplett joshtriplett added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 30, 2021
@Mark-Simulacrum
Copy link
Member

It's not clear to me why it's failing either. It may help to rebase on latest master so we can rerun CI, at least?

It does seem likely to be related to cfg(test) somehow, but I'm not sure how. It may be that we just need to cfg out this impl in cfg(test) or something like that...

@JohnCSimon JohnCSimon added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 5, 2021
@Lucretiel Lucretiel closed this Dec 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants