@@ -413,35 +413,26 @@ impl GlobalState {
413
413
. map ( |res| res. as_ref ( ) . map_err ( |e| e. to_string ( ) ) )
414
414
. chain ( iter:: repeat_with ( || Err ( "proc-macro-srv is not running" . into ( ) ) ) ) ;
415
415
for ( client, paths) in proc_macro_clients. zip ( paths) {
416
- paths
417
- . into_iter ( )
418
- . map ( move |( crate_id, res) | {
419
- (
420
- crate_id,
421
- res. map_or_else (
422
- |e| Err ( ( e, true ) ) ,
423
- |( crate_name, path) | {
424
- progress ( path. to_string ( ) ) ;
425
- client. as_ref ( ) . map_err ( |it| ( it. clone ( ) , true ) ) . and_then (
426
- |client| {
427
- load_proc_macro (
428
- client,
429
- & path,
430
- ignored_proc_macros
431
- . iter ( )
432
- . find_map ( |( name, macros) | {
433
- eq_ignore_underscore ( name, & crate_name)
434
- . then_some ( & * * macros)
435
- } )
436
- . unwrap_or_default ( ) ,
437
- )
438
- } ,
439
- )
440
- } ,
441
- ) ,
442
- )
443
- } )
444
- . for_each ( |( krate, res) | builder. insert ( krate, res) ) ;
416
+ for ( crate_id, res) in paths. iter ( ) {
417
+ let expansion_res = match client {
418
+ Ok ( client) => match res {
419
+ Ok ( ( crate_name, path) ) => {
420
+ progress ( path. to_string ( ) ) ;
421
+ let ignored_proc_macros = ignored_proc_macros
422
+ . iter ( )
423
+ . find_map ( |( name, macros) | {
424
+ eq_ignore_underscore ( name, crate_name) . then_some ( & * * macros)
425
+ } )
426
+ . unwrap_or_default ( ) ;
427
+
428
+ load_proc_macro ( client, path, ignored_proc_macros)
429
+ }
430
+ Err ( e) => Err ( ( e. clone ( ) , true ) ) ,
431
+ } ,
432
+ Err ( ref e) => Err ( ( e. clone ( ) , true ) ) ,
433
+ } ;
434
+ builder. insert ( * crate_id, expansion_res)
435
+ }
445
436
}
446
437
447
438
change. set_proc_macros ( builder) ;
@@ -645,7 +636,7 @@ impl GlobalState {
645
636
Config :: user_config_dir_path ( ) . as_deref ( ) ,
646
637
) ;
647
638
648
- if ( self . proc_macro_clients . is_empty ( ) || !same_workspaces)
639
+ if ( self . proc_macro_clients . len ( ) < self . workspaces . len ( ) || !same_workspaces)
649
640
&& self . config . expand_proc_macros ( )
650
641
{
651
642
info ! ( "Spawning proc-macro servers" ) ;
0 commit comments