mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
Apply suggestions from code review
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
parent
312eafe916
commit
d5de7c21b2
1 changed files with 1 additions and 8 deletions
|
@ -1458,14 +1458,7 @@ impl Const {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn value(self, db: &dyn HirDatabase) -> Option<ast::Expr> {
|
pub fn value(self, db: &dyn HirDatabase) -> Option<ast::Expr> {
|
||||||
let loc = self.id.lookup(db.upcast());
|
self.source(db)?.value.body()
|
||||||
let item_tree = loc.id.item_tree(db.upcast());
|
|
||||||
let ast_id = item_tree[loc.id.value].ast_id;
|
|
||||||
let ast_id_map = db.ast_id_map(loc.id.file_id());
|
|
||||||
let ast_ptr = ast_id_map.get(ast_id);
|
|
||||||
let syntax_node = db.parse_or_expand(loc.id.file_id())?;
|
|
||||||
let ast_node = ast_ptr.to_node(&syntax_node);
|
|
||||||
ast_node.body()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ty(self, db: &dyn HirDatabase) -> Type {
|
pub fn ty(self, db: &dyn HirDatabase) -> Type {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue