@@ -29,7 +29,7 @@ use tracing::error;
2929use ty_python_semantic:: add_inferred_python_version_hint_to_diagnostic;
3030use ty_python_semantic:: lint:: RuleSelection ;
3131use ty_python_semantic:: types:: check_types;
32- pub use ty_python_semantic:: { FxIndexMap , FxIndexSet } ;
32+ pub use ty_python_semantic:: { FxHashMap , FxHashSet } ;
3333
3434mod db;
3535mod files;
@@ -55,7 +55,7 @@ pub struct Project {
5555 /// The files that are open in the project, [`None`] if there are no open files.
5656 #[ returns( ref) ]
5757 #[ default]
58- open_fileset : FxIndexSet < File > ,
58+ open_fileset : FxHashSet < File > ,
5959
6060 /// The first-party files of this project.
6161 #[ default]
@@ -354,7 +354,7 @@ impl Project {
354354 tracing:: debug!( "Closing file `{}`" , file. path( db) ) ;
355355
356356 let mut open_files = self . take_open_files ( db) ;
357- let removed = open_files. swap_remove ( & file) ;
357+ let removed = open_files. remove ( & file) ;
358358
359359 if removed {
360360 self . set_open_files ( db, open_files) ;
@@ -398,25 +398,25 @@ impl Project {
398398 }
399399
400400 /// Returns the open files in the project or `None` if there are no open files.
401- pub fn open_files ( self , db : & dyn Db ) -> & FxIndexSet < File > {
401+ pub fn open_files ( self , db : & dyn Db ) -> & FxHashSet < File > {
402402 self . open_fileset ( db)
403403 }
404404
405405 /// Sets the open files in the project.
406406 #[ tracing:: instrument( level = "debug" , skip( self , db) ) ]
407- pub fn set_open_files ( self , db : & mut dyn Db , open_files : FxIndexSet < File > ) {
407+ pub fn set_open_files ( self , db : & mut dyn Db , open_files : FxHashSet < File > ) {
408408 tracing:: debug!( "Set open project files (count: {})" , open_files. len( ) ) ;
409409
410410 self . set_open_fileset ( db) . to ( open_files) ;
411411 }
412412
413413 /// This takes the open files from the project and returns them.
414- fn take_open_files ( self , db : & mut dyn Db ) -> FxIndexSet < File > {
414+ fn take_open_files ( self , db : & mut dyn Db ) -> FxHashSet < File > {
415415 tracing:: debug!( "Take open project files" ) ;
416416
417417 // Salsa will cancel any pending queries and remove its own reference to `open_files`
418418 // so that the reference counter to `open_files` now drops to 1.
419- self . set_open_fileset ( db) . to ( FxIndexSet :: default ( ) )
419+ self . set_open_fileset ( db) . to ( FxHashSet :: default ( ) )
420420 }
421421
422422 /// Returns `true` if the file should be checked.
@@ -586,7 +586,7 @@ pub(crate) fn check_file_impl(db: &dyn Db, file: File) -> Result<Box<[Diagnostic
586586
587587#[ derive( Debug ) ]
588588enum ProjectFiles < ' a > {
589- OpenFiles ( & ' a FxIndexSet < File > ) ,
589+ OpenFiles ( & ' a FxHashSet < File > ) ,
590590 Indexed ( files:: Indexed < ' a > ) ,
591591}
592592
@@ -619,14 +619,14 @@ impl<'a> IntoIterator for &'a ProjectFiles<'a> {
619619
620620 fn into_iter ( self ) -> Self :: IntoIter {
621621 match self {
622- ProjectFiles :: OpenFiles ( files) => ProjectFilesIter :: OpenFiles ( files. iter ( ) ) ,
622+ ProjectFiles :: OpenFiles ( files) => ProjectFilesIter :: OpenFiles ( files. unstable_iter ( ) ) ,
623623 ProjectFiles :: Indexed ( files) => ProjectFilesIter :: Indexed ( files. into_iter ( ) ) ,
624624 }
625625 }
626626}
627627
628628enum ProjectFilesIter < ' db > {
629- OpenFiles ( indexmap :: set :: Iter < ' db , File > ) ,
629+ OpenFiles ( std :: collections :: hash_set :: Iter < ' db , File > ) ,
630630 Indexed ( files:: IndexedIter < ' db > ) ,
631631}
632632
0 commit comments