Skip to content

Avoid unnecessary heap allocation and copy#181

Merged
PolyMeilex merged 1 commit intoPolyMeilex:masterfrom
ryco117:master
Feb 24, 2024
Merged

Avoid unnecessary heap allocation and copy#181
PolyMeilex merged 1 commit intoPolyMeilex:masterfrom
ryco117:master

Conversation

@ryco117
Copy link
Contributor

@ryco117 ryco117 commented Feb 23, 2024

Looks like the current implementation of From<FileHandle> for PathBuf passes a Path reference to the PathBuf::from which results in a new heap allocation from a call to to_os_string() down the call-stack.

Since From<FileHandle> consumes the FileHandle it seems reasonable to consume the member PathBuf and return it to the caller without any copies or allocations.

@ryco117
Copy link
Contributor Author

ryco117 commented Feb 24, 2024

The error says that the changelog check can be avoided by adding the no changelog label. This seems reasonable since the change will not be visible.

@PolyMeilex PolyMeilex added the no changelog Ignore changelog CI check label Feb 24, 2024
@PolyMeilex PolyMeilex merged commit 73dcdf0 into PolyMeilex:master Feb 24, 2024
@PolyMeilex
Copy link
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no changelog Ignore changelog CI check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants