Apply suggestions from code review

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
Jake 2021-11-17 09:53:24 -08:00 committed by GitHub
parent 312eafe916
commit d5de7c21b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1458,14 +1458,7 @@ impl Const {
}
pub fn value(self, db: &dyn HirDatabase) -> Option<ast::Expr> {
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 {