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.
Hello, I've taken a closer look at the Windows implementation of
is_executable
and I think this can be optimized.First, I believe theAs for theto_string_lossy
can simply be removed from bothextension
andpathext
and shouldn't affect the comparison but I could be wrong on that one so please test this if you are able to..map(|ext| ext[1..].to_string())
, I was able to remove theto_string
by simply merging the cut-off into theany
. Thecollect
is unnecessary and theany
iteration can simply be done immediately instead of collecting into aVec
first.