@@ -225,18 +225,18 @@ mod impl_ {
225
225
return Box :: new ( iter:: empty ( ) ) ;
226
226
} ;
227
227
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( ) ) ) )
232
232
} else {
233
233
None
234
234
}
235
235
} ) )
236
236
}
237
237
238
238
fn find_tool_in_vs16_path ( tool : & str , target : & str ) -> Option < Tool > {
239
- vs16_instances ( ) . find_map ( |path| {
239
+ vs16_instances ( ) . filter_map ( |path| {
240
240
let path = path. join ( tool) ;
241
241
if !path. is_file ( ) {
242
242
return None ;
@@ -246,7 +246,7 @@ mod impl_ {
246
246
tool. env . push ( ( "Platform" . into ( ) , "X64" . into ( ) ) ) ;
247
247
}
248
248
Some ( tool)
249
- } )
249
+ } ) . next ( )
250
250
}
251
251
252
252
fn find_msbuild_vs16 ( target : & str ) -> Option < Tool > {
@@ -307,7 +307,7 @@ mod impl_ {
307
307
. ok ( )
308
308
. and_then ( |key| key. query_str ( "15.0" ) . ok ( ) )
309
309
. 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 } ) ;
311
311
}
312
312
313
313
path. map ( |path| {
@@ -681,7 +681,7 @@ mod impl_ {
681
681
for subkey in key. iter ( ) . filter_map ( |k| k. ok ( ) ) {
682
682
let val = subkey
683
683
. 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 ( ) ) ;
685
685
let val = match val {
686
686
Some ( s) => s,
687
687
None => continue ,
0 commit comments