@@ -273,12 +273,13 @@ impl ImportAssets {
273273 Some ( it) => it,
274274 None => return <FxIndexSet < _ > >:: default ( ) . into_iter ( ) ,
275275 } ;
276+ let db = sema. db ;
276277 let krate = self . module_with_candidate . krate ( ) ;
277278 let scope_definitions = self . scope_definitions ( sema) ;
278279 let mod_path = |item| {
279280 get_mod_path (
280- sema . db ,
281- item_for_path_search ( sema . db , item) ?,
281+ db,
282+ item_for_path_search ( db, item) ?,
282283 & self . module_with_candidate ,
283284 prefixed,
284285 cfg,
@@ -288,7 +289,7 @@ impl ImportAssets {
288289
289290 match & self . import_candidate {
290291 ImportCandidate :: Path ( path_candidate) => path_applicable_imports (
291- sema ,
292+ db ,
292293 & scope,
293294 krate,
294295 path_candidate,
@@ -297,7 +298,7 @@ impl ImportAssets {
297298 ) ,
298299 ImportCandidate :: TraitAssocItem ( trait_candidate)
299300 | ImportCandidate :: TraitMethod ( trait_candidate) => trait_applicable_items (
300- sema ,
301+ db ,
301302 krate,
302303 & scope,
303304 trait_candidate,
@@ -325,7 +326,7 @@ impl ImportAssets {
325326}
326327
327328fn path_applicable_imports (
328- sema : & Semantics < ' _ , RootDatabase > ,
329+ db : & RootDatabase ,
329330 scope : & SemanticsScope < ' _ > ,
330331 current_crate : Crate ,
331332 path_candidate : & PathImportCandidate ,
@@ -337,7 +338,7 @@ fn path_applicable_imports(
337338 match & * path_candidate. qualifier {
338339 [ ] => {
339340 items_locator:: items_with_name (
340- sema ,
341+ db ,
341342 current_crate,
342343 path_candidate. name . clone ( ) ,
343344 // FIXME: we could look up assoc items by the input and propose those in completion,
@@ -365,7 +366,7 @@ fn path_applicable_imports(
365366 // what follows
366367 // FIXME: This doesn't handle visibility
367368 [ first_qsegment, qualifier_rest @ ..] => items_locator:: items_with_name (
368- sema ,
369+ db ,
369370 current_crate,
370371 NameToImport :: Exact ( first_qsegment. as_str ( ) . to_owned ( ) , true ) ,
371372 AssocSearchMode :: Exclude ,
@@ -374,7 +375,7 @@ fn path_applicable_imports(
374375 // we found imports for `first_qsegment`, now we need to filter these imports by whether
375376 // they result in resolving the rest of the path successfully
376377 validate_resolvable (
377- sema ,
378+ db ,
378379 scope,
379380 mod_path,
380381 scope_filter,
@@ -391,7 +392,7 @@ fn path_applicable_imports(
391392/// Validates and builds an import for `resolved_qualifier` if the `unresolved_qualifier` appended
392393/// to it resolves and there is a validate `candidate` after that.
393394fn validate_resolvable (
394- sema : & Semantics < ' _ , RootDatabase > ,
395+ db : & RootDatabase ,
395396 scope : & SemanticsScope < ' _ > ,
396397 mod_path : impl Fn ( ItemInNs ) -> Option < ModPath > ,
397398 scope_filter : impl Fn ( ItemInNs ) -> bool ,
@@ -406,8 +407,8 @@ fn validate_resolvable(
406407 if !unresolved_qualifier. is_empty ( ) {
407408 match resolved_qualifier {
408409 ItemInNs :: Types ( ModuleDef :: Module ( module) ) => {
409- adjusted_resolved_qualifier = sema
410- . resolve_mod_path_relative ( module , unresolved_qualifier. iter ( ) . cloned ( ) ) ?
410+ adjusted_resolved_qualifier = module
411+ . resolve_mod_path ( db , unresolved_qualifier. iter ( ) . cloned ( ) ) ?
411412 . next ( ) ?;
412413 }
413414 // can't resolve multiple segments for non-module item path bases
@@ -424,7 +425,7 @@ fn validate_resolvable(
424425 let ty = match qualifier {
425426 ModuleDef :: Module ( module) => {
426427 return items_locator:: items_with_name_in_module (
427- sema ,
428+ db ,
428429 module,
429430 candidate. clone ( ) ,
430431 AssocSearchMode :: Exclude ,
@@ -439,17 +440,17 @@ fn validate_resolvable(
439440 ModuleDef :: Trait ( _) => return None ,
440441 // FIXME
441442 ModuleDef :: TraitAlias ( _) => return None ,
442- ModuleDef :: TypeAlias ( alias) => alias. ty ( sema . db ) ,
443- ModuleDef :: BuiltinType ( builtin) => builtin. ty ( sema . db ) ,
444- ModuleDef :: Adt ( adt) => adt. ty ( sema . db ) ,
443+ ModuleDef :: TypeAlias ( alias) => alias. ty ( db) ,
444+ ModuleDef :: BuiltinType ( builtin) => builtin. ty ( db) ,
445+ ModuleDef :: Adt ( adt) => adt. ty ( db) ,
445446 _ => return None ,
446447 } ;
447- ty. iterate_path_candidates ( sema . db , scope, & FxHashSet :: default ( ) , None , None , |assoc| {
448+ ty. iterate_path_candidates ( db, scope, & FxHashSet :: default ( ) , None , None , |assoc| {
448449 // FIXME: Support extra trait imports
449- if assoc. container_or_implemented_trait ( sema . db ) . is_some ( ) {
450+ if assoc. container_or_implemented_trait ( db) . is_some ( ) {
450451 return None ;
451452 }
452- let name = assoc. name ( sema . db ) ?;
453+ let name = assoc. name ( db) ?;
453454 let is_match = match candidate {
454455 NameToImport :: Prefix ( text, true ) => name. as_str ( ) . starts_with ( text) ,
455456 NameToImport :: Prefix ( text, false ) => {
@@ -495,7 +496,7 @@ fn item_for_path_search_assoc(db: &RootDatabase, assoc_item: AssocItem) -> Optio
495496}
496497
497498fn trait_applicable_items (
498- sema : & Semantics < ' _ , RootDatabase > ,
499+ db : & RootDatabase ,
499500 current_crate : Crate ,
500501 scope : & SemanticsScope < ' _ > ,
501502 trait_candidate : & TraitImportCandidate ,
@@ -505,15 +506,13 @@ fn trait_applicable_items(
505506) -> FxIndexSet < LocatedImport > {
506507 let _p = tracing:: info_span!( "ImportAssets::trait_applicable_items" ) . entered ( ) ;
507508
508- let db = sema. db ;
509-
510509 let inherent_traits = trait_candidate. receiver_ty . applicable_inherent_traits ( db) ;
511510 let env_traits = trait_candidate. receiver_ty . env_traits ( db) ;
512511 let related_traits = inherent_traits. chain ( env_traits) . collect :: < FxHashSet < _ > > ( ) ;
513512
514513 let mut required_assoc_items = FxHashSet :: default ( ) ;
515514 let mut trait_candidates: FxHashSet < _ > = items_locator:: items_with_name (
516- sema ,
515+ db ,
517516 current_crate,
518517 trait_candidate. assoc_item_name . clone ( ) ,
519518 AssocSearchMode :: AssocItemsOnly ,
0 commit comments