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.
Looks like the current implementation of
From<FileHandle> for PathBuf
passes aPath
reference to thePathBuf::from
which results in a new heap allocation from a call toto_os_string()
down the call-stack.Since
From<FileHandle>
consumes theFileHandle
it seems reasonable to consume the memberPathBuf
and return it to the caller without any copies or allocations.