@@ -48,10 +48,11 @@ use notify_debouncer_full::{
4848 DebouncedEvent , Debouncer , RecommendedCache , new_debouncer,
4949 notify:: { self , RecommendedWatcher } ,
5050} ;
51+ use rustc_hash:: { FxHashMap , FxHashSet } ;
5152use slotmap:: Key as SlotMapKey ;
5253use std:: {
5354 any:: TypeId ,
54- collections:: { BTreeMap , BTreeSet , HashMap , HashSet , VecDeque } ,
55+ collections:: { BTreeMap , BTreeSet , HashMap , VecDeque } ,
5556 env, fmt, fs,
5657 future:: Future ,
5758 io,
@@ -68,6 +69,7 @@ use trash::TrashItem;
6869use wayland_client:: { Proxy , protocol:: wl_output:: WlOutput } ;
6970
7071use crate :: {
72+ FxOrderMap ,
7173 clipboard:: { ClipboardCopy , ClipboardKind , ClipboardPaste } ,
7274 config:: {
7375 AppTheme , Config , DesktopConfig , Favorite , IconSizes , TIME_CONFIG_ID , TabConfig ,
@@ -676,17 +678,17 @@ pub struct App {
676678 dialog_pages : DialogPages ,
677679 dialog_text_input : widget:: Id ,
678680 key_binds : HashMap < KeyBind , Action > ,
679- margin : HashMap < window:: Id , ( f32 , f32 , f32 , f32 ) > ,
681+ margin : FxHashMap < window:: Id , ( f32 , f32 , f32 , f32 ) > ,
680682 mime_app_cache : MimeAppCache ,
681683 modifiers : Modifiers ,
682- mounter_items : HashMap < MounterKey , MounterItems > ,
684+ mounter_items : FxHashMap < MounterKey , MounterItems > ,
683685 must_save_sort_names : bool ,
684686 network_drive_connecting : Option < ( MounterKey , String ) > ,
685687 network_drive_input : String ,
686688 #[ cfg( feature = "notify" ) ]
687689 notification_opt : Option < Arc < Mutex < notify_rust:: NotificationHandle > > > ,
688690 #[ cfg( all( feature = "wayland" , feature = "desktop-applet" ) ) ]
689- overlap : HashMap < String , ( window:: Id , Rectangle ) > ,
691+ overlap : FxHashMap < String , ( window:: Id , Rectangle ) > ,
690692 pending_operation_id : u64 ,
691693 pending_operations : BTreeMap < u64 , ( Operation , Controller ) > ,
692694 progress_operations : BTreeSet < u64 > ,
@@ -696,17 +698,17 @@ pub struct App {
696698 search_id : widget:: Id ,
697699 size : Option < Size > ,
698700 #[ cfg( all( feature = "wayland" , feature = "desktop-applet" ) ) ]
699- layer_sizes : HashMap < window:: Id , Size > ,
701+ layer_sizes : FxHashMap < window:: Id , Size > ,
700702 #[ cfg( all( feature = "wayland" , feature = "desktop-applet" ) ) ]
701- surface_ids : HashMap < WlOutput , WindowId > ,
703+ surface_ids : FxHashMap < WlOutput , WindowId > ,
702704 #[ cfg( all( feature = "wayland" , feature = "desktop-applet" ) ) ]
703- surface_names : HashMap < WindowId , String > ,
705+ surface_names : FxHashMap < WindowId , String > ,
704706 toasts : widget:: toaster:: Toasts < Message > ,
705707 watcher_opt : Option < (
706708 Debouncer < RecommendedWatcher , RecommendedCache > ,
707- HashSet < PathBuf > ,
709+ FxHashSet < PathBuf > ,
708710 ) > ,
709- windows : HashMap < window:: Id , WindowKind > ,
711+ windows : FxHashMap < window:: Id , WindowKind > ,
710712 nav_dnd_hover : Option < ( Location , Instant ) > ,
711713 tab_dnd_hover : Option < ( Entity , Instant ) > ,
712714 nav_drag_id : DragId ,
@@ -731,7 +733,7 @@ impl App {
731733 // Associate all paths to its MIME type
732734 // This allows handling paths as groups if possible, such as launching a single video
733735 // player that is passed every path.
734- let mut groups: HashMap < Mime , Vec < PathBuf > > = HashMap :: new ( ) ;
736+ let mut groups: FxHashMap < Mime , Vec < PathBuf > > = FxHashMap :: default ( ) ;
735737 let mut all_archives = true ;
736738 let supported_archive_types = crate :: archive:: SUPPORTED_ARCHIVE_TYPES
737739 . iter ( )
@@ -948,7 +950,7 @@ impl App {
948950
949951 #[ cfg( all( feature = "wayland" , feature = "desktop-applet" ) ) ]
950952 fn handle_overlap ( & mut self ) {
951- let mut overlaps: HashMap < _ , _ > = self
953+ let mut overlaps: FxHashMap < _ , _ > = self
952954 . windows
953955 . keys ( )
954956 . map ( |k| ( * k, ( 0. , 0. , 0. , 0. ) ) )
@@ -1609,7 +1611,7 @@ impl App {
16091611
16101612 fn update_watcher ( & mut self ) -> Task < Message > {
16111613 if let Some ( ( mut watcher, old_paths) ) = self . watcher_opt . take ( ) {
1612- let mut new_paths = HashSet :: new ( ) ;
1614+ let mut new_paths = FxHashSet :: default ( ) ;
16131615 for entity in self . tab_model . iter ( ) {
16141616 if let Some ( tab) = self . tab_model . data :: < Tab > ( entity) {
16151617 if let Some ( path) = tab. location . path_opt ( ) {
@@ -1978,7 +1980,7 @@ impl App {
19781980 fn get_apps_for_mime ( & self , mime_type : & Mime ) -> Vec < ( & MimeApp , MimeAppMatch ) > {
19791981 let mut results = Vec :: new ( ) ;
19801982
1981- let mut dedupe = HashSet :: new ( ) ;
1983+ let mut dedupe = FxHashSet :: default ( ) ;
19821984
19831985 // start with exact matches
19841986 for mime_app in self . mime_app_cache . get ( mime_type) {
@@ -2160,17 +2162,17 @@ impl Application for App {
21602162 dialog_pages : DialogPages :: new ( ) ,
21612163 dialog_text_input : widget:: Id :: new ( "Dialog Text Input" ) ,
21622164 key_binds,
2163- margin : HashMap :: new ( ) ,
2165+ margin : FxHashMap :: default ( ) ,
21642166 mime_app_cache : MimeAppCache :: new ( ) ,
21652167 modifiers : Modifiers :: empty ( ) ,
2166- mounter_items : HashMap :: new ( ) ,
2168+ mounter_items : FxHashMap :: default ( ) ,
21672169 must_save_sort_names : false ,
21682170 network_drive_connecting : None ,
21692171 network_drive_input : String :: new ( ) ,
21702172 #[ cfg( feature = "notify" ) ]
21712173 notification_opt : None ,
21722174 #[ cfg( all( feature = "wayland" , feature = "desktop-applet" ) ) ]
2173- overlap : HashMap :: new ( ) ,
2175+ overlap : FxHashMap :: default ( ) ,
21742176 pending_operation_id : 0 ,
21752177 pending_operations : BTreeMap :: new ( ) ,
21762178 progress_operations : BTreeSet :: new ( ) ,
@@ -2180,20 +2182,20 @@ impl Application for App {
21802182 search_id : widget:: Id :: new ( "File Search" ) ,
21812183 size : None ,
21822184 #[ cfg( all( feature = "wayland" , feature = "desktop-applet" ) ) ]
2183- surface_ids : HashMap :: new ( ) ,
2185+ surface_ids : FxHashMap :: default ( ) ,
21842186 #[ cfg( all( feature = "wayland" , feature = "desktop-applet" ) ) ]
2185- surface_names : HashMap :: new ( ) ,
2187+ surface_names : FxHashMap :: default ( ) ,
21862188 toasts : widget:: toaster:: Toasts :: new ( Message :: CloseToast ) ,
21872189 watcher_opt : None ,
2188- windows : HashMap :: new ( ) ,
2190+ windows : FxHashMap :: default ( ) ,
21892191 nav_dnd_hover : None ,
21902192 tab_dnd_hover : None ,
21912193 nav_drag_id : DragId :: new ( ) ,
21922194 tab_drag_id : DragId :: new ( ) ,
21932195 auto_scroll_speed : None ,
21942196 file_dialog_opt : None ,
21952197 #[ cfg( all( feature = "wayland" , feature = "desktop-applet" ) ) ]
2196- layer_sizes : HashMap :: new ( ) ,
2198+ layer_sizes : FxHashMap :: default ( ) ,
21972199 } ;
21982200
21992201 let mut commands = vec ! [ app. update_config( ) ] ;
@@ -3264,7 +3266,7 @@ impl Application for App {
32643266 Message :: NotifyWatcher ( mut watcher_wrapper) => match watcher_wrapper. watcher_opt . take ( )
32653267 {
32663268 Some ( watcher) => {
3267- self . watcher_opt = Some ( ( watcher, HashSet :: new ( ) ) ) ;
3269+ self . watcher_opt = Some ( ( watcher, FxHashSet :: default ( ) ) ) ;
32683270 return self . update_watcher ( ) ;
32693271 }
32703272 None => {
@@ -4744,8 +4746,8 @@ impl Application for App {
47444746 Message :: SaveSortNames => {
47454747 self . must_save_sort_names = false ;
47464748 if let Some ( state_handler) = self . state_handler . as_ref ( ) {
4747- if let Err ( err) =
4748- state_handler . set :: < ordermap :: OrderMap < String , ( HeadingOptions , bool ) > > (
4749+ if let Err ( err) = state_handler
4750+ . set :: < FxOrderMap < String , ( HeadingOptions , bool ) > > (
47494751 "sort_names" ,
47504752 self . state . sort_names . clone ( ) ,
47514753 )
0 commit comments