From d5de7c21b27e7ad2ba92c6ce8f386d226bcc6adc Mon Sep 17 00:00:00 2001 From: Jake Date: Wed, 17 Nov 2021 09:53:24 -0800 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Lukas Wirth --- crates/hir/src/lib.rs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index ee7270f295..a528b2bc2d 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -1458,14 +1458,7 @@ impl Const { } pub fn value(self, db: &dyn HirDatabase) -> Option { - let loc = self.id.lookup(db.upcast()); - 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() + self.source(db)?.value.body() } pub fn ty(self, db: &dyn HirDatabase) -> Type {