From 6d104de15aee6a24a442871c59528c39d410c161 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 13 Jun 2021 16:42:34 +0300 Subject: internal: refactor unresolved import diagnostic --- crates/hir/src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'crates/hir/src/lib.rs') diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index f7883c469..d32246709 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -498,7 +498,10 @@ impl Module { let import = &item_tree[id.value]; let use_tree = import.use_tree_to_ast(db.upcast(), file_id, *index); - sink.push(UnresolvedImport { file: file_id, node: AstPtr::new(&use_tree) }); + acc.push( + UnresolvedImport { decl: InFile::new(file_id, AstPtr::new(&use_tree)) } + .into(), + ); } DefDiagnosticKind::UnconfiguredCode { ast, cfg, opts } => { -- cgit v1.2.3 From fa9ed4e0ce633e51d1411951bf044719e6837457 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 13 Jun 2021 17:06:36 +0300 Subject: internal: refactor unresolved macro call diagnostic --- crates/hir/src/lib.rs | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'crates/hir/src/lib.rs') diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index d32246709..0a9414013 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -580,11 +580,13 @@ impl Module { DefDiagnosticKind::UnresolvedMacroCall { ast, path } => { let node = ast.to_node(db.upcast()); - sink.push(UnresolvedMacroCall { - file: ast.file_id, - node: AstPtr::new(&node), - path: path.clone(), - }); + acc.push( + UnresolvedMacroCall { + macro_call: InFile::new(ast.file_id, AstPtr::new(&node)), + path: path.clone(), + } + .into(), + ); } DefDiagnosticKind::MacroError { ast, message } => { @@ -1060,13 +1062,9 @@ impl Function { precise_location: None, macro_name: None, }), - BodyDiagnostic::UnresolvedMacroCall { node, path } => { - sink.push(UnresolvedMacroCall { - file: node.file_id, - node: node.value.clone(), - path: path.clone(), - }) - } + BodyDiagnostic::UnresolvedMacroCall { node, path } => acc.push( + UnresolvedMacroCall { macro_call: node.clone(), path: path.clone() }.into(), + ), } } -- cgit v1.2.3