diff options
author | Aleksey Kladov <[email protected]> | 2019-05-28 16:07:39 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-05-28 16:07:39 +0100 |
commit | c8bcfe6a05d82e151d459bcd2bd8a7b2742f7a66 (patch) | |
tree | 407e3ec2b7b4a88634e85c113d5e219cc413535a /crates/ra_hir/src/expr | |
parent | 2e3f5af9d49db5732405050e6c5442cb6eeef965 (diff) |
fix syntax errors in tests
Diffstat (limited to 'crates/ra_hir/src/expr')
-rw-r--r-- | crates/ra_hir/src/expr/scope.rs | 4 | ||||
-rw-r--r-- | crates/ra_hir/src/expr/validation.rs | 2 |
2 files changed, 3 insertions, 3 deletions
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 { | |||
190 | }; | 190 | }; |
191 | 191 | ||
192 | let (db, _source_root, file_id) = MockDatabase::with_single_file(&code); | 192 | let (db, _source_root, file_id) = MockDatabase::with_single_file(&code); |
193 | let file = db.parse(file_id); | 193 | let file = db.parse(file_id).ok().unwrap(); |
194 | let marker: &ast::PathExpr = find_node_at_offset(file.syntax(), off).unwrap(); | 194 | let marker: &ast::PathExpr = find_node_at_offset(file.syntax(), off).unwrap(); |
195 | let analyzer = SourceAnalyzer::new(&db, file_id, marker.syntax(), None); | 195 | let analyzer = SourceAnalyzer::new(&db, file_id, marker.syntax(), None); |
196 | 196 | ||
@@ -288,7 +288,7 @@ mod tests { | |||
288 | let (off, code) = extract_offset(code); | 288 | let (off, code) = extract_offset(code); |
289 | 289 | ||
290 | let (db, _source_root, file_id) = MockDatabase::with_single_file(&code); | 290 | let (db, _source_root, file_id) = MockDatabase::with_single_file(&code); |
291 | let file = db.parse(file_id); | 291 | let file = db.parse(file_id).ok().unwrap(); |
292 | let expected_name = find_node_at_offset::<ast::Name>(file.syntax(), expected_offset.into()) | 292 | let expected_name = find_node_at_offset::<ast::Name>(file.syntax(), expected_offset.into()) |
293 | .expect("failed to find a name at the target offset"); | 293 | .expect("failed to find a name at the target offset"); |
294 | let name_ref: &ast::NameRef = find_node_at_offset(file.syntax(), off).unwrap(); | 294 | 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> { | |||
75 | } | 75 | } |
76 | let source_map = self.func.body_source_map(db); | 76 | let source_map = self.func.body_source_map(db); |
77 | let file_id = self.func.source(db).0; | 77 | let file_id = self.func.source(db).0; |
78 | let source_file = db.parse(file_id.original_file(db)); | 78 | let source_file = db.parse(file_id.original_file(db)).tree; |
79 | if let Some(field_list_node) = source_map | 79 | if let Some(field_list_node) = source_map |
80 | .expr_syntax(id) | 80 | .expr_syntax(id) |
81 | .map(|ptr| ptr.to_node(source_file.syntax())) | 81 | .map(|ptr| ptr.to_node(source_file.syntax())) |