2525//! dispatcher.add_handler(Box::new(MyHandler));
2626//! ```
2727
28+ use sha2:: { Digest , Sha256 } ;
2829use std:: collections:: HashMap ;
2930use std:: fs:: File ;
3031use std:: io:: { self , Read } ;
@@ -505,7 +506,9 @@ impl Default for EventDispatcher {
505506impl EventDispatcher {
506507 /// Create a new event dispatcher.
507508 pub fn new ( ) -> Self {
508- Self { handlers : Vec :: new ( ) }
509+ Self {
510+ handlers : Vec :: new ( ) ,
511+ }
509512 }
510513
511514 /// Add an event handler.
@@ -520,22 +523,25 @@ impl EventDispatcher {
520523
521524 /// Raise the compilation starting event.
522525 pub fn raise_compilation_starting ( & self , args : & mut CompilationStartedEventArgs ) {
523- tracing:: debug!( "Raising CompilationStarting event to {} handlers" , self . handlers. len( ) ) ;
526+ tracing:: debug!(
527+ "Raising CompilationStarting event to {} handlers" ,
528+ self . handlers. len( )
529+ ) ;
524530 for handler in & self . handlers {
525531 handler. on_compilation_starting ( args) ;
526532 if args. cancel {
527- tracing:: info!(
528- "Compilation cancelled: {:?}" ,
529- args. cancel_reason
530- ) ;
533+ tracing:: info!( "Compilation cancelled: {:?}" , args. cancel_reason) ;
531534 break ;
532535 }
533536 }
534537 }
535538
536539 /// Raise the configuration loaded event.
537540 pub fn raise_configuration_loaded ( & self , args : & ConfigurationLoadedEventArgs ) {
538- tracing:: debug!( "Raising ConfigurationLoaded event to {} handlers" , self . handlers. len( ) ) ;
541+ tracing:: debug!(
542+ "Raising ConfigurationLoaded event to {} handlers" ,
543+ self . handlers. len( )
544+ ) ;
539545 for handler in & self . handlers {
540546 handler. on_configuration_loaded ( args) ;
541547 }
@@ -643,11 +649,7 @@ impl EventDispatcher {
643649 for handler in & self . handlers {
644650 handler. on_chunk_started ( args) ;
645651 if args. skip {
646- tracing:: info!(
647- "Chunk {} skipped: {:?}" ,
648- args. chunk_index,
649- args. skip_reason
650- ) ;
652+ tracing:: info!( "Chunk {} skipped: {:?}" , args. chunk_index, args. skip_reason) ;
651653 break ;
652654 }
653655 }
@@ -695,15 +697,21 @@ impl EventDispatcher {
695697
696698 /// Raise the compilation completed event.
697699 pub fn raise_compilation_completed ( & self , args : & CompilationCompletedEventArgs ) {
698- tracing:: debug!( "Raising CompilationCompleted event to {} handlers" , self . handlers. len( ) ) ;
700+ tracing:: debug!(
701+ "Raising CompilationCompleted event to {} handlers" ,
702+ self . handlers. len( )
703+ ) ;
699704 for handler in & self . handlers {
700705 handler. on_compilation_completed ( args) ;
701706 }
702707 }
703708
704709 /// Raise the compilation error event.
705710 pub fn raise_compilation_error ( & self , args : & mut CompilationErrorEventArgs ) {
706- tracing:: debug!( "Raising CompilationError event to {} handlers" , self . handlers. len( ) ) ;
711+ tracing:: debug!(
712+ "Raising CompilationError event to {} handlers" ,
713+ self . handlers. len( )
714+ ) ;
707715 for handler in & self . handlers {
708716 handler. on_compilation_error ( args) ;
709717 }
@@ -934,11 +942,7 @@ mod tests {
934942
935943 #[ test]
936944 fn test_validation_finding ( ) {
937- let finding = ValidationFinding :: new (
938- ValidationSeverity :: Error ,
939- "E001" ,
940- "Test error" ,
941- ) ;
945+ let finding = ValidationFinding :: new ( ValidationSeverity :: Error , "E001" , "Test error" ) ;
942946 assert_eq ! ( finding. severity, ValidationSeverity :: Error ) ;
943947 assert_eq ! ( finding. code, "E001" ) ;
944948 }
0 commit comments