Skip to content

Commit d5de7c2

Browse files
jhggVeykril
andauthored
Apply suggestions from code review
Co-authored-by: Lukas Wirth <[email protected]>
1 parent 312eafe commit d5de7c2

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

crates/hir/src/lib.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1458,14 +1458,7 @@ impl Const {
14581458
}
14591459

14601460
pub fn value(self, db: &dyn HirDatabase) -> Option<ast::Expr> {
1461-
let loc = self.id.lookup(db.upcast());
1462-
let item_tree = loc.id.item_tree(db.upcast());
1463-
let ast_id = item_tree[loc.id.value].ast_id;
1464-
let ast_id_map = db.ast_id_map(loc.id.file_id());
1465-
let ast_ptr = ast_id_map.get(ast_id);
1466-
let syntax_node = db.parse_or_expand(loc.id.file_id())?;
1467-
let ast_node = ast_ptr.to_node(&syntax_node);
1468-
ast_node.body()
1461+
self.source(db)?.value.body()
14691462
}
14701463

14711464
pub fn ty(self, db: &dyn HirDatabase) -> Type {

0 commit comments

Comments
 (0)