From 549728bba87ed8f4375f27bb9a77223bf8f65452 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 13 May 2019 19:39:06 +0300 Subject: make AstId untyped --- crates/ra_ide_api/src/diagnostics.rs | 6 +++--- crates/ra_ide_api/src/display/navigation_target.rs | 2 +- crates/ra_ide_api/src/references.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'crates/ra_ide_api') diff --git a/crates/ra_ide_api/src/diagnostics.rs b/crates/ra_ide_api/src/diagnostics.rs index 855a3ff0f..e23d178b0 100644 --- a/crates/ra_ide_api/src/diagnostics.rs +++ b/crates/ra_ide_api/src/diagnostics.rs @@ -54,7 +54,7 @@ pub(crate) fn diagnostics(db: &RootDatabase, file_id: FileId) -> Vec let file_id = d.file().original_file(db); let source_file = db.parse(file_id); let syntax_node = d.syntax_node_ptr(); - let node = NamedFieldList::cast(syntax_node.to_node(&source_file)).unwrap(); + let node = NamedFieldList::cast(syntax_node.to_node(source_file.syntax())).unwrap(); let mut ast_editor = AstEditor::new(node); for f in d.missed_fields.iter() { ast_editor.append_field(&AstBuilder::::from_name(f)); @@ -281,7 +281,7 @@ mod tests { one: i32, two: i64, } - + fn test_fn() { let one = 1; let s = TestStruct{ one, two: 2 }; @@ -298,7 +298,7 @@ mod tests { one: i32, two: i64, } - + fn test_fn() { let one = 1; let s = TestStruct{ ..a }; diff --git a/crates/ra_ide_api/src/display/navigation_target.rs b/crates/ra_ide_api/src/display/navigation_target.rs index 765cf883b..7ea336c50 100644 --- a/crates/ra_ide_api/src/display/navigation_target.rs +++ b/crates/ra_ide_api/src/display/navigation_target.rs @@ -81,7 +81,7 @@ impl NavigationTarget { ) -> NavigationTarget { let file = db.parse(file_id); let (name, full_range) = match pat { - Either::A(pat) => match pat.to_node(&file).kind() { + Either::A(pat) => match pat.to_node(file.syntax()).kind() { ast::PatKind::BindPat(pat) => { return NavigationTarget::from_bind_pat(file_id, &pat) } diff --git a/crates/ra_ide_api/src/references.rs b/crates/ra_ide_api/src/references.rs index 9f655d83c..d5c2b08ca 100644 --- a/crates/ra_ide_api/src/references.rs +++ b/crates/ra_ide_api/src/references.rs @@ -86,7 +86,7 @@ pub(crate) fn find_all_refs( let analyzer = hir::SourceAnalyzer::new(db, position.file_id, name_ref.syntax(), None); let resolved = analyzer.resolve_local_name(name_ref)?; if let Either::A(ptr) = resolved.ptr() { - if let ast::PatKind::BindPat(binding) = ptr.to_node(source_file).kind() { + if let ast::PatKind::BindPat(binding) = ptr.to_node(source_file.syntax()).kind() { return Some((binding, analyzer)); } } -- cgit v1.2.3