aboutsummaryrefslogtreecommitdiff
path: root/crates/hir
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir')
-rw-r--r--crates/hir/src/display.rs4
-rw-r--r--crates/hir/src/lib.rs26
2 files changed, 6 insertions, 24 deletions
diff --git a/crates/hir/src/display.rs b/crates/hir/src/display.rs
index c5cf803fd..72f0d9b5f 100644
--- a/crates/hir/src/display.rs
+++ b/crates/hir/src/display.rs
@@ -427,10 +427,6 @@ impl HirDisplay for Trait {
427 write!(f, "trait {}", data.name)?; 427 write!(f, "trait {}", data.name)?;
428 let def_id = GenericDefId::TraitId(self.id); 428 let def_id = GenericDefId::TraitId(self.id);
429 write_generic_params(def_id, f)?; 429 write_generic_params(def_id, f)?;
430 if !data.bounds.is_empty() {
431 write!(f, ": ")?;
432 f.write_joined(&*data.bounds, " + ")?;
433 }
434 write_where_clause(def_id, f)?; 430 write_where_clause(def_id, f)?;
435 Ok(()) 431 Ok(())
436 } 432 }
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index 1ecd2391b..01b2de515 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -472,27 +472,13 @@ impl Module {
472 }); 472 });
473 } 473 }
474 474
475 DefDiagnosticKind::UnresolvedImport { ast, index } => { 475 DefDiagnosticKind::UnresolvedImport { id, index } => {
476 let use_item = ast.to_node(db.upcast()); 476 let file_id = id.file_id();
477 let hygiene = Hygiene::new(db.upcast(), ast.file_id); 477 let item_tree = id.item_tree(db.upcast());
478 let mut cur = 0; 478 let import = &item_tree[id.value];
479 let mut tree = None;
480 ModPath::expand_use_item(
481 db.upcast(),
482 InFile::new(ast.file_id, use_item),
483 &hygiene,
484 |_mod_path, use_tree, _is_glob, _alias| {
485 if cur == *index {
486 tree = Some(use_tree.clone());
487 }
488
489 cur += 1;
490 },
491 );
492 479
493 if let Some(tree) = tree { 480 let use_tree = import.use_tree_to_ast(db.upcast(), file_id, *index);
494 sink.push(UnresolvedImport { file: ast.file_id, node: AstPtr::new(&tree) }); 481 sink.push(UnresolvedImport { file: file_id, node: AstPtr::new(&use_tree) });
495 }
496 } 482 }
497 483
498 DefDiagnosticKind::UnconfiguredCode { ast, cfg, opts } => { 484 DefDiagnosticKind::UnconfiguredCode { ast, cfg, opts } => {