File tree 1 file changed +9
-7
lines changed
1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -34,15 +34,17 @@ impl Finder {
34
34
35
35
fn maybe_have < S : AsRef < OsStr > > ( & mut self , cmd : S ) -> Option < PathBuf > {
36
36
let cmd: OsString = cmd. as_ref ( ) . into ( ) ;
37
- let path = self . path . clone ( ) ;
37
+ let path = & self . path ;
38
38
self . cache . entry ( cmd. clone ( ) ) . or_insert_with ( || {
39
- for path in env:: split_paths ( & path) {
39
+ for path in env:: split_paths ( path) {
40
40
let target = path. join ( & cmd) ;
41
- let mut cmd_alt = cmd. clone ( ) ;
42
- cmd_alt. push ( ".exe" ) ;
43
- if target. is_file ( ) || // some/path/git
44
- target. with_extension ( "exe" ) . exists ( ) || // some/path/git.exe
45
- target. join ( & cmd_alt) . exists ( ) { // some/path/git/git.exe
41
+ let mut cmd_exe = cmd. clone ( ) ;
42
+ cmd_exe. push ( ".exe" ) ;
43
+
44
+ if target. is_file ( ) // some/path/git
45
+ || path. join ( & cmd_exe) . exists ( ) // some/path/git.exe
46
+ || target. join ( & cmd_exe) . exists ( ) // some/path/git/git.exe
47
+ {
46
48
return Some ( target) ;
47
49
}
48
50
}
You can’t perform that action at this time.
0 commit comments