fitzgen / is_executable

Is there an executable file at the given path?
Apache License 2.0
17 stars 8 forks source link

Avoid some allocations #8

Closed wooster0 closed 2 years ago

wooster0 commented 3 years ago

Hello, I've taken a closer look at the Windows implementation of is_executable and I think this can be optimized. First, I believe the to_string_lossy can simply be removed from both extension and pathext and shouldn't affect the comparison but I could be wrong on that one so please test this if you are able to. As for the .map(|ext| ext[1..].to_string()), I was able to remove the to_string by simply merging the cut-off into the any. The collect is unnecessary and the any iteration can simply be done immediately instead of collecting into a Vec first.

wooster0 commented 3 years ago

I'm not entirely sure why it fails but I'm going to close this for now.

alpha-tango-kilo commented 2 years ago

Let's get this merged! @fitzgen

If you wanted help maintaining the project, I'd be happy to offer my services :)