@@ -509,9 +509,15 @@ impl<T: FileIdCache> DebounceDataInner<T> {
509509 let path = & event. paths [ 0 ] ;
510510
511511 if let Some ( queue) = self . queues . get_mut ( path) {
512- // skip duplicate create events and modifications right after creation
512+ // Skip duplicate create events and modifications right after creation.
513+ // This code relies on backends never emitting a `Modify` event with kind other than `Name` for a rename event.
513514 if match event. kind {
514- EventKind :: Modify ( ModifyKind :: Data ( _) | ModifyKind :: Metadata ( _) )
515+ EventKind :: Modify (
516+ ModifyKind :: Any
517+ | ModifyKind :: Data ( _)
518+ | ModifyKind :: Metadata ( _)
519+ | ModifyKind :: Other ,
520+ )
515521 | EventKind :: Create ( _) => !queue. was_created ( ) ,
516522 _ => true ,
517523 } {
@@ -639,16 +645,14 @@ pub fn new_debouncer_opt<F: DebounceEventHandler, T: Watcher, C: FileIdCache + S
639645 Some ( v) => {
640646 if v > timeout {
641647 return Err ( Error :: new ( ErrorKind :: Generic ( format ! (
642- "Invalid tick_rate, tick rate {:?} > {:?} timeout!" ,
643- v, timeout
648+ "Invalid tick_rate, tick rate {v:?} > {timeout:?} timeout!"
644649 ) ) ) ) ;
645650 }
646651 v
647652 }
648653 None => timeout. checked_div ( tick_div) . ok_or_else ( || {
649654 Error :: new ( ErrorKind :: Generic ( format ! (
650- "Failed to calculate tick as {:?}/{}!" ,
651- timeout, tick_div
655+ "Failed to calculate tick as {timeout:?}/{tick_div}!"
652656 ) ) )
653657 } ) ?,
654658 } ;
@@ -782,6 +786,7 @@ mod tests {
782786 "add_create_event_after_remove_event" ,
783787 "add_create_dir_event_twice" ,
784788 "add_event_with_no_paths_is_ok" ,
789+ "add_modify_any_event_after_create_event" ,
785790 "add_modify_content_event_after_create_event" ,
786791 "add_rename_from_event" ,
787792 "add_rename_from_event_after_create_event" ,
@@ -868,7 +873,7 @@ mod tests {
868873 state
869874 . errors
870875 . iter( )
871- . map( |e| format!( "{:?}" , e ) )
876+ . map( |e| format!( "{e :?}" ) )
872877 . collect:: <Vec <_>>( ) ,
873878 expected_errors
874879 . iter( )
0 commit comments