@@ -388,7 +388,7 @@ pub fn search_dependencies<'a>(
388
388
db : & ' a dyn DefDatabase ,
389
389
krate : CrateId ,
390
390
query : Query ,
391
- ) -> Vec < ItemInNs > {
391
+ ) -> FxHashSet < ItemInNs > {
392
392
let _p = profile:: span ( "search_dependencies" ) . detail ( || format ! ( "{:?}" , query) ) ;
393
393
394
394
let graph = db. crate_graph ( ) ;
@@ -403,7 +403,7 @@ pub fn search_dependencies<'a>(
403
403
}
404
404
405
405
let mut stream = op. union ( ) ;
406
- let mut res = Vec :: new ( ) ;
406
+ let mut res = FxHashSet :: default ( ) ;
407
407
while let Some ( ( _, indexed_values) ) = stream. next ( ) {
408
408
for indexed_value in indexed_values {
409
409
let import_map = & import_maps[ indexed_value. index ] ;
@@ -435,7 +435,6 @@ pub fn search_dependencies<'a>(
435
435
res. extend ( iter) ;
436
436
437
437
if res. len ( ) >= query. limit {
438
- res. truncate ( query. limit ) ;
439
438
return res;
440
439
}
441
440
}
@@ -821,10 +820,10 @@ mod tests {
821
820
Query :: new ( "fmt" . to_string ( ) ) . search_mode ( SearchMode :: Fuzzy ) ,
822
821
expect ! [ [ r#"
823
822
dep::fmt (t)
823
+ dep::fmt::Display::format_method (a)
824
824
dep::fmt::Display (t)
825
825
dep::fmt::Display::FMT_CONST (a)
826
826
dep::fmt::Display::format_function (a)
827
- dep::fmt::Display::format_method (a)
828
827
"# ] ] ,
829
828
) ;
830
829
}
@@ -850,9 +849,9 @@ mod tests {
850
849
"main" ,
851
850
Query :: new ( "fmt" . to_string ( ) ) . search_mode ( SearchMode :: Fuzzy ) . assoc_items_only ( ) ,
852
851
expect ! [ [ r#"
852
+ dep::fmt::Display::format_method (a)
853
853
dep::fmt::Display::FMT_CONST (a)
854
854
dep::fmt::Display::format_function (a)
855
- dep::fmt::Display::format_method (a)
856
855
"# ] ] ,
857
856
) ;
858
857
@@ -911,12 +910,12 @@ mod tests {
911
910
Query :: new ( "fmt" . to_string ( ) ) . search_mode ( SearchMode :: Fuzzy ) ,
912
911
expect ! [ [ r#"
913
912
dep::fmt (t)
914
- dep::Fmt (t )
913
+ dep::format (f )
915
914
dep::Fmt (v)
916
- dep::Fmt (m)
917
915
dep::fmt::Display (t)
916
+ dep::Fmt (t)
918
917
dep::fmt::Display::fmt (a)
919
- dep::format (f )
918
+ dep::Fmt (m )
920
919
"# ] ] ,
921
920
) ;
922
921
@@ -926,10 +925,10 @@ mod tests {
926
925
Query :: new ( "fmt" . to_string ( ) ) . search_mode ( SearchMode :: Equals ) ,
927
926
expect ! [ [ r#"
928
927
dep::fmt (t)
929
- dep::Fmt (t)
930
928
dep::Fmt (v)
931
- dep::Fmt (m )
929
+ dep::Fmt (t )
932
930
dep::fmt::Display::fmt (a)
931
+ dep::Fmt (m)
933
932
"# ] ] ,
934
933
) ;
935
934
@@ -939,11 +938,11 @@ mod tests {
939
938
Query :: new ( "fmt" . to_string ( ) ) . search_mode ( SearchMode :: Contains ) ,
940
939
expect ! [ [ r#"
941
940
dep::fmt (t)
942
- dep::Fmt (t)
943
941
dep::Fmt (v)
944
- dep::Fmt (m)
945
942
dep::fmt::Display (t)
943
+ dep::Fmt (t)
946
944
dep::fmt::Display::fmt (a)
945
+ dep::Fmt (m)
947
946
"# ] ] ,
948
947
) ;
949
948
}
@@ -980,11 +979,11 @@ mod tests {
980
979
Query :: new ( "fmt" . to_string ( ) ) ,
981
980
expect ! [ [ r#"
982
981
dep::fmt (t)
983
- dep::Fmt (t)
984
982
dep::Fmt (v)
985
- dep::Fmt (m)
986
983
dep::fmt::Display (t)
984
+ dep::Fmt (t)
987
985
dep::fmt::Display::fmt (a)
986
+ dep::Fmt (m)
988
987
"# ] ] ,
989
988
) ;
990
989
@@ -994,10 +993,10 @@ mod tests {
994
993
Query :: new ( "fmt" . to_string ( ) ) . name_only ( ) ,
995
994
expect ! [ [ r#"
996
995
dep::fmt (t)
997
- dep::Fmt (t)
998
996
dep::Fmt (v)
999
- dep::Fmt (m )
997
+ dep::Fmt (t )
1000
998
dep::fmt::Display::fmt (a)
999
+ dep::Fmt (m)
1001
1000
"# ] ] ,
1002
1001
) ;
1003
1002
}
@@ -1018,9 +1017,9 @@ mod tests {
1018
1017
Query :: new ( "FMT" . to_string ( ) ) ,
1019
1018
expect ! [ [ r#"
1020
1019
dep::fmt (t)
1020
+ dep::FMT (v)
1021
1021
dep::fmt (v)
1022
1022
dep::FMT (t)
1023
- dep::FMT (v)
1024
1023
"# ] ] ,
1025
1024
) ;
1026
1025
@@ -1060,6 +1059,8 @@ mod tests {
1060
1059
expect ! [ [ r#"
1061
1060
dep::fmt (t)
1062
1061
dep::Fmt (t)
1062
+ dep::Fmt (m)
1063
+ dep::Fmt (v)
1063
1064
"# ] ] ,
1064
1065
) ;
1065
1066
}
@@ -1080,9 +1081,9 @@ mod tests {
1080
1081
Query :: new ( "FMT" . to_string ( ) ) ,
1081
1082
expect ! [ [ r#"
1082
1083
dep::fmt (t)
1084
+ dep::FMT (v)
1083
1085
dep::fmt (v)
1084
1086
dep::FMT (t)
1085
- dep::FMT (v)
1086
1087
"# ] ] ,
1087
1088
) ;
1088
1089
0 commit comments