From c8bcfe6a05d82e151d459bcd2bd8a7b2742f7a66 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 28 May 2019 18:07:39 +0300 Subject: fix syntax errors in tests --- crates/ra_hir/src/expr/scope.rs | 4 ++-- crates/ra_hir/src/expr/validation.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/ra_hir/src/expr') diff --git a/crates/ra_hir/src/expr/scope.rs b/crates/ra_hir/src/expr/scope.rs index 58f365128..83d226fc1 100644 --- a/crates/ra_hir/src/expr/scope.rs +++ b/crates/ra_hir/src/expr/scope.rs @@ -190,7 +190,7 @@ mod tests { }; let (db, _source_root, file_id) = MockDatabase::with_single_file(&code); - let file = db.parse(file_id); + let file = db.parse(file_id).ok().unwrap(); let marker: &ast::PathExpr = find_node_at_offset(file.syntax(), off).unwrap(); let analyzer = SourceAnalyzer::new(&db, file_id, marker.syntax(), None); @@ -288,7 +288,7 @@ mod tests { let (off, code) = extract_offset(code); let (db, _source_root, file_id) = MockDatabase::with_single_file(&code); - let file = db.parse(file_id); + let file = db.parse(file_id).ok().unwrap(); let expected_name = find_node_at_offset::(file.syntax(), expected_offset.into()) .expect("failed to find a name at the target offset"); let name_ref: &ast::NameRef = find_node_at_offset(file.syntax(), off).unwrap(); diff --git a/crates/ra_hir/src/expr/validation.rs b/crates/ra_hir/src/expr/validation.rs index 3f758f283..2816144a7 100644 --- a/crates/ra_hir/src/expr/validation.rs +++ b/crates/ra_hir/src/expr/validation.rs @@ -75,7 +75,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> { } let source_map = self.func.body_source_map(db); let file_id = self.func.source(db).0; - let source_file = db.parse(file_id.original_file(db)); + let source_file = db.parse(file_id.original_file(db)).tree; if let Some(field_list_node) = source_map .expr_syntax(id) .map(|ptr| ptr.to_node(source_file.syntax())) -- cgit v1.2.3