mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
Option begone part 2
This commit is contained in:
parent
96a774261f
commit
a2a3fecae3
31 changed files with 113 additions and 152 deletions
|
@ -730,7 +730,7 @@ pub type AstId<N> = InFile<FileAstId<N>>;
|
|||
|
||||
impl<N: AstNode> AstId<N> {
|
||||
pub fn to_node(&self, db: &dyn db::ExpandDatabase) -> N {
|
||||
let root = db.parse_or_expand(self.file_id).unwrap();
|
||||
let root = db.parse_or_expand(self.file_id);
|
||||
db.ast_id_map(self.file_id).get(self.value).to_node(&root)
|
||||
}
|
||||
}
|
||||
|
@ -766,7 +766,7 @@ impl<T> InFile<T> {
|
|||
}
|
||||
|
||||
pub fn file_syntax(&self, db: &dyn db::ExpandDatabase) -> SyntaxNode {
|
||||
db.parse_or_expand(self.file_id).expect("source created from invalid file")
|
||||
db.parse_or_expand(self.file_id)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue