Skip to content
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

Remove need for allocation inside Reader #1794

Merged
merged 2 commits into from
Jun 2, 2022

Conversation

rylev
Copy link
Contributor

@rylev rylev commented Jun 2, 2022

This should be easier to understand, less code, have less rightward drift, completely eliminate all allocation, and be much less hacky than some alternatives.

Copy link
Collaborator

@kennykerr kennykerr left a comment

Choose a reason for hiding this comment

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

Sweet - thanks!

@rylev rylev merged commit 35d3f0d into microsoft:master Jun 2, 2022
@rylev rylev deleted the remove-collect2 branch June 2, 2022 15:26
@kennykerr
Copy link
Collaborator

Here's another related case:

pub fn flatten(&self) -> Vec<&Tree> {
// TODO: surely there's a way to do this without a ton of intermediate Vec's...
std::iter::once(self).chain(self.nested.values().flat_map(|tree| tree.flatten())).collect()
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants