@@ -4,8 +4,8 @@ pub mod update;
44
55use crate :: app:: apps:: App ;
66use crate :: app:: {
7- ArrowKey , Message , Move , Page , FILE_SEARCH_BATCH_SIZE , FILE_SEARCH_ICON_BATCH_SIZE ,
8- FILE_SEARCH_MAX_ICONS , FILE_SEARCH_MAX_RESULTS ,
7+ ArrowKey , FILE_SEARCH_BATCH_SIZE , FILE_SEARCH_ICON_BATCH_SIZE , FILE_SEARCH_MAX_ICONS ,
8+ FILE_SEARCH_MAX_RESULTS , Message , Move , Page ,
99} ;
1010use crate :: clipboard:: ClipBoardContentType ;
1111use crate :: config:: Config ;
@@ -42,8 +42,8 @@ use tray_icon::TrayIcon;
4242use std:: collections:: HashMap ;
4343use std:: fmt:: Debug ;
4444use std:: str:: FromStr ;
45- use std:: sync:: atomic:: { AtomicBool , Ordering } ;
4645use std:: sync:: Arc ;
46+ use std:: sync:: atomic:: { AtomicBool , Ordering } ;
4747use std:: time:: Duration ;
4848
4949/// This is a wrapper around the sender to disable dropping
@@ -462,9 +462,8 @@ fn configure_metadata_query(
462462 // parses the format string and substitutes %@ with the argument array values.
463463 // The format string is a compile-time constant and args contains a single valid
464464 // NSString, so the call is well-formed.
465- let predicate = unsafe {
466- NSPredicate :: predicateWithFormat_argumentArray ( & format_str, Some ( & args) )
467- } ;
465+ let predicate =
466+ unsafe { NSPredicate :: predicateWithFormat_argumentArray ( & format_str, Some ( & args) ) } ;
468467 query. setPredicate ( Some ( & predicate) ) ;
469468
470469 let scope_strings: Vec < objc2:: rc:: Retained < NSString > > = dirs
@@ -499,8 +498,7 @@ fn drain_metadata_results(
499498 let limit = count. min ( FILE_SEARCH_MAX_RESULTS as usize ) ;
500499 let attr_key = unsafe { NSMetadataItemPathKey } ;
501500
502- let mut batch: Vec < crate :: app:: apps:: App > =
503- Vec :: with_capacity ( FILE_SEARCH_BATCH_SIZE as usize ) ;
501+ let mut batch: Vec < crate :: app:: apps:: App > = Vec :: with_capacity ( FILE_SEARCH_BATCH_SIZE as usize ) ;
504502 let mut paths: Vec < String > = Vec :: with_capacity ( limit) ;
505503 let mut idx: usize = 0 ;
506504
@@ -549,7 +547,10 @@ fn load_file_search_icons(
549547) {
550548 let limit = paths. len ( ) . min ( FILE_SEARCH_MAX_ICONS ) ;
551549
552- assert ! ( FILE_SEARCH_ICON_BATCH_SIZE > 0 , "Batch size must be positive." ) ;
550+ assert ! (
551+ FILE_SEARCH_ICON_BATCH_SIZE > 0 ,
552+ "Batch size must be positive."
553+ ) ;
553554
554555 let mut icon_batch: Vec < ( usize , iced:: widget:: image:: Handle ) > =
555556 Vec :: with_capacity ( FILE_SEARCH_ICON_BATCH_SIZE ) ;
@@ -582,7 +583,9 @@ fn load_file_search_icons(
582583
583584 if icon_batch. len ( ) >= FILE_SEARCH_ICON_BATCH_SIZE || idx >= limit {
584585 if !icon_batch. is_empty ( ) {
585- if let Err ( e) = msg_tx. try_send ( QueryThreadMsg :: Icons ( std:: mem:: take ( & mut icon_batch) ) ) {
586+ if let Err ( e) =
587+ msg_tx. try_send ( QueryThreadMsg :: Icons ( std:: mem:: take ( & mut icon_batch) ) )
588+ {
586589 warn ! ( "Failed to send icon batch: {e}" ) ;
587590 }
588591 }
@@ -643,9 +646,11 @@ fn metadata_query_thread_setup() -> (
643646
644647 let results_ready = Arc :: new ( AtomicBool :: new ( false ) ) ;
645648 let flag = results_ready. clone ( ) ;
646- let block = RcBlock :: new ( move |_: core:: ptr:: NonNull < objc2_foundation:: NSNotification > | {
647- flag. store ( true , Ordering :: Release ) ;
648- } ) ;
649+ let block = RcBlock :: new (
650+ move |_: core:: ptr:: NonNull < objc2_foundation:: NSNotification > | {
651+ flag. store ( true , Ordering :: Release ) ;
652+ } ,
653+ ) ;
649654
650655 let center = NSNotificationCenter :: defaultCenter ( ) ;
651656 // SAFETY: addObserverForName registers a notification block with the default center.
@@ -659,7 +664,10 @@ fn metadata_query_thread_setup() -> (
659664 )
660665 } ;
661666
662- assert ! ( !results_ready. load( Ordering :: Acquire ) , "Flag must start false." ) ;
667+ assert ! (
668+ !results_ready. load( Ordering :: Acquire ) ,
669+ "Flag must start false."
670+ ) ;
663671 assert ! ( query. resultCount( ) == 0 , "Query must start empty." ) ;
664672
665673 ( query, results_ready, observer)
0 commit comments