File tree Expand file tree Collapse file tree 1 file changed +2
-10
lines changed
Expand file tree Collapse file tree 1 file changed +2
-10
lines changed Original file line number Diff line number Diff line change @@ -105,10 +105,7 @@ pub fn identify_python_environment_using_locators(
105105 "Identifying Python environment using locators: {:?}" ,
106106 executable
107107 ) ;
108- if let Some ( env) = locators. iter ( ) . fold (
109- None ,
110- |e, loc| if e. is_some ( ) { e } else { loc. try_from ( env) } ,
111- ) {
108+ if let Some ( env) = locators. iter ( ) . find_map ( |loc| loc. try_from ( env) ) {
112109 return Some ( env) ;
113110 }
114111 trace ! (
@@ -121,12 +118,7 @@ pub fn identify_python_environment_using_locators(
121118 // We try to get the interpreter info, hoping that the real exe returned might be identifiable.
122119 if let Some ( resolved_env) = ResolvedPythonEnv :: from ( & executable) {
123120 let env = resolved_env. to_python_env ( ) ;
124- if let Some ( env) =
125- locators. iter ( ) . fold (
126- None ,
127- |e, loc| if e. is_some ( ) { e } else { loc. try_from ( & env) } ,
128- )
129- {
121+ if let Some ( env) = locators. iter ( ) . find_map ( |loc| loc. try_from ( & env) ) {
130122 trace ! ( "Env ({:?}) in Path resolved as {:?}" , executable, env. kind) ;
131123 // TODO: Telemetry point.
132124 // As we had to spawn earlier.
You can’t perform that action at this time.
0 commit comments