@@ -95,20 +95,20 @@ pub(crate) fn import_on_the_fly(acc: &mut Completions, ctx: &CompletionContext)
95
95
. search_for_imports ( & ctx. sema , ctx. config . insert_use . prefix_kind )
96
96
. into_iter ( )
97
97
. map ( |import| {
98
- let proposed_def = match import. item_to_display ( ) {
98
+ let def_to_display = match import. item_to_display ( ) {
99
99
ItemInNs :: Types ( id) => ScopeDef :: ModuleDef ( id. into ( ) ) ,
100
100
ItemInNs :: Values ( id) => ScopeDef :: ModuleDef ( id. into ( ) ) ,
101
101
ItemInNs :: Macros ( id) => ScopeDef :: MacroDef ( id. into ( ) ) ,
102
102
} ;
103
- ( import, proposed_def )
103
+ ( import, def_to_display )
104
104
} )
105
105
. collect :: < Vec < _ > > ( ) ;
106
106
all_mod_paths. sort_by_cached_key ( |( import, _) | {
107
107
compute_fuzzy_completion_order_key ( import. display_path ( ) , & user_input_lowercased)
108
108
} ) ;
109
109
110
- acc. add_all ( all_mod_paths. into_iter ( ) . filter_map ( |( import, definition ) | {
111
- let import_for_trait_assoc_item = match definition {
110
+ acc. add_all ( all_mod_paths. into_iter ( ) . filter_map ( |( import, def_to_display ) | {
111
+ let import_for_trait_assoc_item = match def_to_display {
112
112
ScopeDef :: ModuleDef ( module_def) => module_def
113
113
. as_assoc_item ( ctx. db )
114
114
. and_then ( |assoc| assoc. containing_trait ( ctx. db ) )
@@ -117,7 +117,7 @@ pub(crate) fn import_on_the_fly(acc: &mut Completions, ctx: &CompletionContext)
117
117
} ;
118
118
let import_edit =
119
119
ImportEdit { import, import_scope : import_scope. clone ( ) , import_for_trait_assoc_item } ;
120
- render_resolution_with_import ( RenderContext :: new ( ctx) , import_edit, & definition )
120
+ render_resolution_with_import ( RenderContext :: new ( ctx) , import_edit, & def_to_display )
121
121
} ) ) ;
122
122
Some ( ( ) )
123
123
}
@@ -867,61 +867,6 @@ mod foo {
867
867
fn main() {
868
868
bar::Item::TEST_ASSOC
869
869
}
870
- "# ,
871
- ) ;
872
- }
873
-
874
- #[ test]
875
- fn unresolved_assoc_item_container_and_trait_with_path ( ) {
876
- check_edit (
877
- "TEST_ASSOC" ,
878
- r#"
879
- mod foo {
880
- pub mod bar {
881
- pub trait SomeTrait {
882
- const TEST_ASSOC: usize;
883
- }
884
- }
885
-
886
- pub mod baz {
887
- use super::bar::SomeTrait;
888
-
889
- pub struct Item;
890
-
891
- impl SomeTrait for Item {
892
- const TEST_ASSOC: usize = 3;
893
- }
894
- }
895
- }
896
-
897
- fn main() {
898
- baz::Item::TEST_A$0
899
- }
900
- "# ,
901
- r#"
902
- use foo::{bar::SomeTrait, baz};
903
-
904
- mod foo {
905
- pub mod bar {
906
- pub trait SomeTrait {
907
- const TEST_ASSOC: usize;
908
- }
909
- }
910
-
911
- pub mod baz {
912
- use super::bar::SomeTrait;
913
-
914
- pub struct Item;
915
-
916
- impl SomeTrait for Item {
917
- const TEST_ASSOC: usize = 3;
918
- }
919
- }
920
- }
921
-
922
- fn main() {
923
- baz::Item::TEST_ASSOC
924
- }
925
870
"# ,
926
871
) ;
927
872
}
0 commit comments