diff options
author | Aleksey Kladov <[email protected]> | 2020-04-17 12:55:05 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-04-17 12:56:42 +0100 |
commit | 146f6f5a45a4bfd98ab0eb54bb30610d784433c9 (patch) | |
tree | e56f182d50f8863c2535fcd9d736ffb4e3425ae6 /crates/ra_hir_def | |
parent | a8196ffe8466aa60dec56e77c2da717793c0debe (diff) |
Simplify Diagnostic structure
It's not entirely clear what subnode ranges should mean in the
presence of macros, so let's leave them out for now. We are not using
them heavily anyway.
Diffstat (limited to 'crates/ra_hir_def')
-rw-r--r-- | crates/ra_hir_def/src/diagnostics.rs | 6 | ||||
-rw-r--r-- | crates/ra_hir_def/src/nameres.rs | 3 |
2 files changed, 2 insertions, 7 deletions
diff --git a/crates/ra_hir_def/src/diagnostics.rs b/crates/ra_hir_def/src/diagnostics.rs index 2ee28fbaa..510c5e064 100644 --- a/crates/ra_hir_def/src/diagnostics.rs +++ b/crates/ra_hir_def/src/diagnostics.rs | |||
@@ -4,7 +4,7 @@ use std::any::Any; | |||
4 | 4 | ||
5 | use hir_expand::diagnostics::Diagnostic; | 5 | use hir_expand::diagnostics::Diagnostic; |
6 | use ra_db::RelativePathBuf; | 6 | use ra_db::RelativePathBuf; |
7 | use ra_syntax::{ast, AstPtr, SyntaxNodePtr, TextRange}; | 7 | use ra_syntax::{ast, AstPtr, SyntaxNodePtr}; |
8 | 8 | ||
9 | use hir_expand::{HirFileId, InFile}; | 9 | use hir_expand::{HirFileId, InFile}; |
10 | 10 | ||
@@ -12,7 +12,6 @@ use hir_expand::{HirFileId, InFile}; | |||
12 | pub struct UnresolvedModule { | 12 | pub struct UnresolvedModule { |
13 | pub file: HirFileId, | 13 | pub file: HirFileId, |
14 | pub decl: AstPtr<ast::Module>, | 14 | pub decl: AstPtr<ast::Module>, |
15 | pub highlight_range: TextRange, | ||
16 | pub candidate: RelativePathBuf, | 15 | pub candidate: RelativePathBuf, |
17 | } | 16 | } |
18 | 17 | ||
@@ -20,9 +19,6 @@ impl Diagnostic for UnresolvedModule { | |||
20 | fn message(&self) -> String { | 19 | fn message(&self) -> String { |
21 | "unresolved module".to_string() | 20 | "unresolved module".to_string() |
22 | } | 21 | } |
23 | fn highlight_range(&self) -> InFile<TextRange> { | ||
24 | InFile::new(self.file, self.highlight_range) | ||
25 | } | ||
26 | fn source(&self) -> InFile<SyntaxNodePtr> { | 22 | fn source(&self) -> InFile<SyntaxNodePtr> { |
27 | InFile::new(self.file, self.decl.clone().into()) | 23 | InFile::new(self.file, self.decl.clone().into()) |
28 | } | 24 | } |
diff --git a/crates/ra_hir_def/src/nameres.rs b/crates/ra_hir_def/src/nameres.rs index 4a5a93dad..f279c2ad4 100644 --- a/crates/ra_hir_def/src/nameres.rs +++ b/crates/ra_hir_def/src/nameres.rs | |||
@@ -297,7 +297,7 @@ pub enum ModuleSource { | |||
297 | mod diagnostics { | 297 | mod diagnostics { |
298 | use hir_expand::diagnostics::DiagnosticSink; | 298 | use hir_expand::diagnostics::DiagnosticSink; |
299 | use ra_db::RelativePathBuf; | 299 | use ra_db::RelativePathBuf; |
300 | use ra_syntax::{ast, AstNode, AstPtr}; | 300 | use ra_syntax::{ast, AstPtr}; |
301 | 301 | ||
302 | use crate::{db::DefDatabase, diagnostics::UnresolvedModule, nameres::LocalModuleId, AstId}; | 302 | use crate::{db::DefDatabase, diagnostics::UnresolvedModule, nameres::LocalModuleId, AstId}; |
303 | 303 | ||
@@ -326,7 +326,6 @@ mod diagnostics { | |||
326 | sink.push(UnresolvedModule { | 326 | sink.push(UnresolvedModule { |
327 | file: declaration.file_id, | 327 | file: declaration.file_id, |
328 | decl: AstPtr::new(&decl), | 328 | decl: AstPtr::new(&decl), |
329 | highlight_range: decl.syntax().text_range(), | ||
330 | candidate: candidate.clone(), | 329 | candidate: candidate.clone(), |
331 | }) | 330 | }) |
332 | } | 331 | } |