@@ -225,18 +225,18 @@ mod impl_ {
225225 return Box :: new ( iter:: empty ( ) ) ;
226226 } ;
227227 Box :: new ( instances. filter_map ( |instance| {
228- let instance = instance. ok ( ) ? ;
229- let installation_name = instance. installation_name ( ) . ok ( ) ? ;
230- if installation_name. to_str ( ) ? . starts_with ( "VisualStudio/16." ) {
231- Some ( PathBuf :: from ( instance. installation_path ( ) . ok ( ) ? ) )
228+ let instance = otry ! ( instance. ok( ) ) ;
229+ let installation_name = otry ! ( instance. installation_name( ) . ok( ) ) ;
230+ if otry ! ( installation_name. to_str( ) ) . starts_with ( "VisualStudio/16." ) {
231+ Some ( PathBuf :: from ( otry ! ( instance. installation_path( ) . ok( ) ) ) )
232232 } else {
233233 None
234234 }
235235 } ) )
236236 }
237237
238238 fn find_tool_in_vs16_path ( tool : & str , target : & str ) -> Option < Tool > {
239- vs16_instances ( ) . find_map ( |path| {
239+ vs16_instances ( ) . filter_map ( |path| {
240240 let path = path. join ( tool) ;
241241 if !path. is_file ( ) {
242242 return None ;
@@ -246,7 +246,7 @@ mod impl_ {
246246 tool. env . push ( ( "Platform" . into ( ) , "X64" . into ( ) ) ) ;
247247 }
248248 Some ( tool)
249- } )
249+ } ) . next ( )
250250 }
251251
252252 fn find_msbuild_vs16 ( target : & str ) -> Option < Tool > {
@@ -307,7 +307,7 @@ mod impl_ {
307307 . ok ( )
308308 . and_then ( |key| key. query_str ( "15.0" ) . ok ( ) )
309309 . map ( |path| PathBuf :: from ( path) . join ( tool) )
310- . filter ( | ref path| path. is_file ( ) ) ;
310+ . and_then ( | path| if path. is_file ( ) { Some ( path ) } else { None } ) ;
311311 }
312312
313313 path. map ( |path| {
@@ -681,7 +681,7 @@ mod impl_ {
681681 for subkey in key. iter ( ) . filter_map ( |k| k. ok ( ) ) {
682682 let val = subkey
683683 . to_str ( )
684- . and_then ( |s| s. trim_start_matches ( "v" ) . replace ( "." , "" ) . parse ( ) . ok ( ) ) ;
684+ . and_then ( |s| s. trim_left_matches ( "v" ) . replace ( "." , "" ) . parse ( ) . ok ( ) ) ;
685685 let val = match val {
686686 Some ( s) => s,
687687 None => continue ,
0 commit comments