@@ -365,7 +365,7 @@ impl Runtime {
365365 & ' a mut self ,
366366 scope : & Scope < ' a > ,
367367 check_syntax_errors : bool ,
368- tx_error : & ' a DiagnosticSender ,
368+ tx_error : Option < & ' a DiagnosticSender > ,
369369 on_module_to_lint : impl Fn ( & ' a Self , ModuleToLint ) + Send + Sync + Clone + ' a ,
370370 ) {
371371 if self . resolver . is_none ( ) {
@@ -590,7 +590,7 @@ impl Runtime {
590590
591591 pub ( super ) fn run ( & mut self , tx_error : & DiagnosticSender ) {
592592 rayon:: scope ( |scope| {
593- self . resolve_modules ( scope, true , tx_error, |me, mut module_to_lint| {
593+ self . resolve_modules ( scope, true , Some ( tx_error) , |me, mut module_to_lint| {
594594 module_to_lint. content . with_dependent_mut ( |allocator_guard, dep| {
595595 // If there are fixes, we will accumulate all of them and write to the file at the end.
596596 // This means we do not write multiple times to the same file if there are multiple sources
@@ -690,9 +690,8 @@ impl Runtime {
690690 let message_cloner = MessageCloner :: new ( allocator) ;
691691
692692 let messages = Mutex :: new ( Vec :: < MessageWithPosition < ' a > > :: new ( ) ) ;
693- let ( sender, _receiver) = mpsc:: channel ( ) ;
694693 rayon:: scope ( |scope| {
695- self . resolve_modules ( scope, true , & sender , |me, mut module_to_lint| {
694+ self . resolve_modules ( scope, true , None , |me, mut module_to_lint| {
696695 module_to_lint. content . with_dependent_mut (
697696 |allocator_guard, ModuleContentDependent { source_text, section_contents } | {
698697 assert_eq ! (
@@ -752,17 +751,6 @@ impl Runtime {
752751 } ) ;
753752 } ) ;
754753
755- // The receiving messages should be only file system reads or source type errors
756- // while let Ok(diagnostics) = receiver.recv() {
757- // if let Some(diagnostics) = diagnostics {
758- // messages.lock().unwrap().extend(
759- // diagnostics.1
760- // .into_iter()
761- // .map(|report| MessageWithPosition::from(report))
762- // );
763- // }
764- // }
765-
766754 messages. into_inner ( ) . unwrap ( )
767755 }
768756
@@ -780,7 +768,7 @@ impl Runtime {
780768
781769 let messages = Mutex :: new ( Vec :: < Message < ' a > > :: new ( ) ) ;
782770 rayon:: scope ( |scope| {
783- self . resolve_modules ( scope, check_syntax_errors, tx_error, |me, mut module| {
771+ self . resolve_modules ( scope, check_syntax_errors, Some ( tx_error) , |me, mut module| {
784772 module. content . with_dependent_mut (
785773 |allocator_guard, ModuleContentDependent { source_text : _, section_contents } | {
786774 assert_eq ! ( module. section_module_records. len( ) , section_contents. len( ) ) ;
@@ -836,7 +824,7 @@ impl Runtime {
836824 & self ,
837825 path : & Arc < OsStr > ,
838826 check_syntax_errors : bool ,
839- tx_error : & DiagnosticSender ,
827+ tx_error : Option < & DiagnosticSender > ,
840828 ) -> ModuleProcessOutput < ' _ > {
841829 let processed_module =
842830 self . process_path_to_module ( path, check_syntax_errors, tx_error) . unwrap_or_default ( ) ;
@@ -847,7 +835,7 @@ impl Runtime {
847835 & self ,
848836 path : & Arc < OsStr > ,
849837 check_syntax_errors : bool ,
850- tx_error : & DiagnosticSender ,
838+ tx_error : Option < & DiagnosticSender > ,
851839 ) -> Option < ProcessedModule < ' _ > > {
852840 let ext = Path :: new ( path) . extension ( ) . and_then ( OsStr :: to_str) ?;
853841
@@ -875,7 +863,9 @@ impl Runtime {
875863 let ( source_type, source_text) = match stt {
876864 Ok ( v) => v,
877865 Err ( e) => {
878- tx_error. send ( ( Path :: new ( path) . to_path_buf ( ) , vec ! [ e] ) ) . unwrap ( ) ;
866+ if let Some ( tx_error) = tx_error {
867+ tx_error. send ( ( Path :: new ( path) . to_path_buf ( ) , vec ! [ e] ) ) . unwrap ( ) ;
868+ }
879869 return Err ( ( ) ) ;
880870 }
881871 } ;
@@ -904,7 +894,9 @@ impl Runtime {
904894 let ( source_type, source_text) = match stt {
905895 Ok ( v) => v,
906896 Err ( e) => {
907- tx_error. send ( ( Path :: new ( path) . to_path_buf ( ) , vec ! [ e] ) ) . unwrap ( ) ;
897+ if let Some ( tx_error) = tx_error {
898+ tx_error. send ( ( Path :: new ( path) . to_path_buf ( ) , vec ! [ e] ) ) . unwrap ( ) ;
899+ }
908900 return None ;
909901 }
910902 } ;
0 commit comments