@@ -441,14 +441,14 @@ pub(crate) fn is_ty_module_cache_up_to_date(
441
441
) -> bool {
442
442
let cache = engines. qe ( ) . module_cache . read ( ) ;
443
443
let key = ModuleCacheKey :: new ( path. clone ( ) , include_tests) ;
444
- cache. get ( & key) . map_or ( false , |entry| {
445
- entry. typed . as_ref ( ) . map_or ( false , |typed| {
444
+ cache. get ( & key) . is_some_and ( |entry| {
445
+ entry. typed . as_ref ( ) . is_some_and ( |typed| {
446
446
// Check if the cache is up to date based on file versions
447
447
let cache_up_to_date = build_config
448
448
. and_then ( |x| x. lsp_mode . as_ref ( ) )
449
449
. and_then ( |lsp| lsp. file_versions . get ( path. as_ref ( ) ) )
450
450
. map_or ( true , |version| {
451
- version. map_or ( true , |v| typed. version . map_or ( false , |tv| v <= tv) )
451
+ version. map_or ( true , |v| typed. version . is_some_and ( |tv| v <= tv) )
452
452
} ) ;
453
453
454
454
// If the cache is up to date, recursively check all dependencies
@@ -472,7 +472,7 @@ pub(crate) fn is_parse_module_cache_up_to_date(
472
472
) -> bool {
473
473
let cache = engines. qe ( ) . module_cache . read ( ) ;
474
474
let key = ModuleCacheKey :: new ( path. clone ( ) , include_tests) ;
475
- cache. get ( & key) . map_or ( false , |entry| {
475
+ cache. get ( & key) . is_some_and ( |entry| {
476
476
// Determine if the cached dependency information is still valid
477
477
let cache_up_to_date = build_config
478
478
. and_then ( |x| x. lsp_mode . as_ref ( ) )
@@ -498,7 +498,7 @@ pub(crate) fn is_parse_module_cache_up_to_date(
498
498
// - If there's no cached version (entry.parsed.version is None), the cache is outdated.
499
499
// - If there's a cached version, compare them: cache is up-to-date if the LSP file version
500
500
// is not greater than the cached version.
501
- version. map_or ( true , |v| entry. parsed . version . map_or ( false , |ev| v <= ev) )
501
+ version. map_or ( true , |v| entry. parsed . version . is_some_and ( |ev| v <= ev) )
502
502
} ,
503
503
) ;
504
504
@@ -601,10 +601,7 @@ pub fn parsed_to_ast(
601
601
experimental,
602
602
) ;
603
603
604
- let mut typed_program = match typed_program_opt {
605
- Ok ( typed_program) => typed_program,
606
- Err ( e) => return Err ( e) ,
607
- } ;
604
+ let mut typed_program = typed_program_opt?;
608
605
609
606
check_should_abort ( handler, retrigger_compilation. clone ( ) ) . map_err ( |error| {
610
607
TypeCheckFailed {
0 commit comments