mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 22:31:43 +00:00
fix syntax errors in tests
This commit is contained in:
parent
2e3f5af9d4
commit
c8bcfe6a05
7 changed files with 137 additions and 121 deletions
|
@ -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::<ast::Name>(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();
|
||||
|
|
|
@ -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()))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue