mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
tweak diagnostics API
This commit is contained in:
parent
4c4a714328
commit
5ce84f3cbc
3 changed files with 16 additions and 11 deletions
|
@ -9,7 +9,7 @@ use relative_path::RelativePathBuf;
|
|||
use test_utils::{parse_fixture, CURSOR_MARKER, extract_offset};
|
||||
use rustc_hash::FxHashMap;
|
||||
|
||||
use crate::{db, HirInterner, diagnostics::DiagnosticSink, DefDatabase};
|
||||
use crate::{db, HirInterner, diagnostics::DiagnosticSink};
|
||||
|
||||
pub const WORKSPACE: SourceRootId = SourceRootId(0);
|
||||
|
||||
|
@ -79,9 +79,7 @@ impl MockDatabase {
|
|||
module.diagnostics(
|
||||
self,
|
||||
&mut DiagnosticSink::new(|d| {
|
||||
let source_file = self.hir_parse(d.file());
|
||||
let syntax_node = d.syntax_node().to_node(&source_file);
|
||||
buf += &format!("{:?}: {}\n", syntax_node.text(), d.message());
|
||||
buf += &format!("{:?}: {}\n", d.syntax_node(self).text(), d.message());
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue