File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -34,15 +34,17 @@ impl Finder {
3434
3535 fn maybe_have < S : AsRef < OsStr > > ( & mut self , cmd : S ) -> Option < PathBuf > {
3636 let cmd: OsString = cmd. as_ref ( ) . into ( ) ;
37- let path = self . path . clone ( ) ;
37+ let path = & self . path ;
3838 self . cache . entry ( cmd. clone ( ) ) . or_insert_with ( || {
39- for path in env:: split_paths ( & path) {
39+ for path in env:: split_paths ( path) {
4040 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+ {
4648 return Some ( target) ;
4749 }
4850 }
You can’t perform that action at this time.
0 commit comments