@@ -318,7 +318,6 @@ pub enum SearchMode {
318
318
pub struct Query {
319
319
query : String ,
320
320
lowercased : String ,
321
- name_only : bool ,
322
321
assoc_items_only : bool ,
323
322
search_mode : SearchMode ,
324
323
case_sensitive : bool ,
@@ -332,7 +331,6 @@ impl Query {
332
331
Self {
333
332
query,
334
333
lowercased,
335
- name_only : false ,
336
334
assoc_items_only : false ,
337
335
search_mode : SearchMode :: Contains ,
338
336
case_sensitive : false ,
@@ -341,13 +339,6 @@ impl Query {
341
339
}
342
340
}
343
341
344
- /// Matches entries' names only, ignoring the rest of
345
- /// the qualifier.
346
- /// Example: for `std::marker::PhantomData`, the name is `PhantomData`.
347
- pub fn name_only ( self ) -> Self {
348
- Self { name_only : true , ..self }
349
- }
350
-
351
342
/// Matches only the entries that are associated items, ignoring the rest.
352
343
pub fn assoc_items_only ( self ) -> Self {
353
344
Self { assoc_items_only : true , ..self }
@@ -389,17 +380,13 @@ impl Query {
389
380
return false ;
390
381
}
391
382
392
- let mut input = if import. is_trait_assoc_item || self . name_only {
393
- import. path . segments . last ( ) . unwrap ( ) . display ( db. upcast ( ) ) . to_string ( )
394
- } else {
395
- import. path . display ( db) . to_string ( )
396
- } ;
397
- if enforce_lowercase || !self . case_sensitive {
383
+ let mut input = import. path . segments . last ( ) . unwrap ( ) . display ( db. upcast ( ) ) . to_string ( ) ;
384
+ let case_insensitive = enforce_lowercase || !self . case_sensitive ;
385
+ if case_insensitive {
398
386
input. make_ascii_lowercase ( ) ;
399
387
}
400
388
401
- let query_string =
402
- if !enforce_lowercase && self . case_sensitive { & self . query } else { & self . lowercased } ;
389
+ let query_string = if case_insensitive { & self . lowercased } else { & self . query } ;
403
390
404
391
match self . search_mode {
405
392
SearchMode :: Equals => & input == query_string,
@@ -875,7 +862,6 @@ mod tests {
875
862
Query :: new ( "fmt" . to_string ( ) ) . search_mode ( SearchMode :: Fuzzy ) ,
876
863
expect ! [ [ r#"
877
864
dep::fmt (t)
878
- dep::fmt::Display (t)
879
865
dep::fmt::Display::FMT_CONST (a)
880
866
dep::fmt::Display::format_function (a)
881
867
dep::fmt::Display::format_method (a)
@@ -917,9 +903,8 @@ mod tests {
917
903
. search_mode ( SearchMode :: Fuzzy )
918
904
. exclude_import_kind ( ImportKind :: AssociatedItem ) ,
919
905
expect ! [ [ r#"
920
- dep::fmt (t)
921
- dep::fmt::Display (t)
922
- "# ] ] ,
906
+ dep::fmt (t)
907
+ "# ] ] ,
923
908
) ;
924
909
925
910
check_search (
@@ -968,7 +953,6 @@ mod tests {
968
953
dep::Fmt (t)
969
954
dep::Fmt (v)
970
955
dep::fmt (t)
971
- dep::fmt::Display (t)
972
956
dep::fmt::Display::fmt (a)
973
957
dep::format (f)
974
958
"# ] ] ,
@@ -996,7 +980,6 @@ mod tests {
996
980
dep::Fmt (t)
997
981
dep::Fmt (v)
998
982
dep::fmt (t)
999
- dep::fmt::Display (t)
1000
983
dep::fmt::Display::fmt (a)
1001
984
"# ] ] ,
1002
985
) ;
@@ -1037,15 +1020,14 @@ mod tests {
1037
1020
dep::Fmt (t)
1038
1021
dep::Fmt (v)
1039
1022
dep::fmt (t)
1040
- dep::fmt::Display (t)
1041
1023
dep::fmt::Display::fmt (a)
1042
1024
"# ] ] ,
1043
1025
) ;
1044
1026
1045
1027
check_search (
1046
1028
ra_fixture,
1047
1029
"main" ,
1048
- Query :: new ( "fmt" . to_string ( ) ) . name_only ( ) ,
1030
+ Query :: new ( "fmt" . to_string ( ) ) ,
1049
1031
expect ! [ [ r#"
1050
1032
dep::Fmt (m)
1051
1033
dep::Fmt (t)
0 commit comments