@@ -130,7 +130,6 @@ impl<'a> ImportAssets<'a> {
130
130
131
131
#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
132
132
pub struct LocatedImport {
133
- // TODO kb extract both into a separate struct + add another field: `assoc_item_name: Optional<String|Name>`
134
133
import_path : ModPath ,
135
134
item_to_import : ItemInNs ,
136
135
data_to_display : Option < ( ModPath , ItemInNs ) > ,
@@ -146,7 +145,7 @@ impl LocatedImport {
146
145
}
147
146
148
147
pub fn display_path ( & self ) -> & ModPath {
149
- self . data_to_display . as_ref ( ) . map ( |( mod_pathh , _) | mod_pathh ) . unwrap_or ( & self . import_path )
148
+ self . data_to_display . as_ref ( ) . map ( |( mod_path , _) | mod_path ) . unwrap_or ( & self . import_path )
150
149
}
151
150
152
151
pub fn import_path ( & self ) -> & ModPath {
@@ -227,14 +226,7 @@ impl<'a> ImportAssets<'a> {
227
226
self . applicable_defs ( sema. db , prefixed, defs_for_candidate_name)
228
227
. into_iter ( )
229
228
. filter ( |import| import. import_path ( ) . len ( ) > 1 )
230
- . filter ( |import| {
231
- let proposed_def = match import. item_to_import ( ) {
232
- ItemInNs :: Types ( id) => ScopeDef :: ModuleDef ( id. into ( ) ) ,
233
- ItemInNs :: Values ( id) => ScopeDef :: ModuleDef ( id. into ( ) ) ,
234
- ItemInNs :: Macros ( id) => ScopeDef :: MacroDef ( id. into ( ) ) ,
235
- } ;
236
- !scope_definitions. contains ( & proposed_def)
237
- } )
229
+ . filter ( |import| !scope_definitions. contains ( & ScopeDef :: from ( import. item_to_import ( ) ) ) )
238
230
. collect ( )
239
231
}
240
232
@@ -314,8 +306,8 @@ fn import_for_item(
314
306
unresolved_qualifier : & str ,
315
307
original_item : ItemInNs ,
316
308
) -> Option < LocatedImport > {
317
- let ( item_candidate, trait_to_import) = match original_item {
318
- ItemInNs :: Types ( module_def_id ) | ItemInNs :: Values ( module_def_id) => {
309
+ let ( item_candidate, trait_to_import) = match original_item. as_module_def_id ( ) {
310
+ Some ( module_def_id) => {
319
311
match ModuleDef :: from ( module_def_id) . as_assoc_item ( db) . map ( |assoc| assoc. container ( db) )
320
312
{
321
313
Some ( AssocItemContainer :: Trait ( trait_) ) => {
@@ -328,7 +320,7 @@ fn import_for_item(
328
320
None => ( original_item, None ) ,
329
321
}
330
322
}
331
- ItemInNs :: Macros ( _ ) => ( original_item, None ) ,
323
+ None => ( original_item, None ) ,
332
324
} ;
333
325
let import_path_candidate = mod_path ( item_candidate) ?;
334
326
0 commit comments