@@ -50,7 +50,7 @@ pub trait FileLoader {
50
50
/// Text of the file.
51
51
fn file_text ( & self , file_id : FileId ) -> Arc < str > ;
52
52
fn resolve_path ( & self , path : AnchoredPath < ' _ > ) -> Option < FileId > ;
53
- fn relevant_crates ( & self , file_id : FileId ) -> Arc < FxHashSet < CrateId > > ;
53
+ fn relevant_crates ( & self , file_id : FileId ) -> Arc < [ CrateId ] > ;
54
54
}
55
55
56
56
/// Database which stores all significant input facts: source code and project
@@ -85,19 +85,20 @@ pub trait SourceDatabaseExt: SourceDatabase {
85
85
#[ salsa:: input]
86
86
fn source_root ( & self , id : SourceRootId ) -> Arc < SourceRoot > ;
87
87
88
- fn source_root_crates ( & self , id : SourceRootId ) -> Arc < FxHashSet < CrateId > > ;
88
+ fn source_root_crates ( & self , id : SourceRootId ) -> Arc < [ CrateId ] > ;
89
89
}
90
90
91
- fn source_root_crates ( db : & dyn SourceDatabaseExt , id : SourceRootId ) -> Arc < FxHashSet < CrateId > > {
91
+ fn source_root_crates ( db : & dyn SourceDatabaseExt , id : SourceRootId ) -> Arc < [ CrateId ] > {
92
92
let graph = db. crate_graph ( ) ;
93
- let res = graph
93
+ graph
94
94
. iter ( )
95
95
. filter ( |& krate| {
96
96
let root_file = graph[ krate] . root_file_id ;
97
97
db. file_source_root ( root_file) == id
98
98
} )
99
- . collect ( ) ;
100
- Arc :: new ( res)
99
+ . collect :: < FxHashSet < _ > > ( )
100
+ . into_iter ( )
101
+ . collect ( )
101
102
}
102
103
103
104
/// Silly workaround for cyclic deps between the traits
@@ -114,7 +115,7 @@ impl<T: SourceDatabaseExt> FileLoader for FileLoaderDelegate<&'_ T> {
114
115
source_root. resolve_path ( path)
115
116
}
116
117
117
- fn relevant_crates ( & self , file_id : FileId ) -> Arc < FxHashSet < CrateId > > {
118
+ fn relevant_crates ( & self , file_id : FileId ) -> Arc < [ CrateId ] > {
118
119
let _p = profile:: span ( "relevant_crates" ) ;
119
120
let source_root = self . 0 . file_source_root ( file_id) ;
120
121
self . 0 . source_root_crates ( source_root)
0 commit comments