aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/code_model_impl
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-01-24 21:26:54 +0000
committerAleksey Kladov <[email protected]>2019-01-24 21:32:37 +0000
commitf588535273db261c32e23c1b0221d03ad82cd94d (patch)
tree5d664933d8383f436a8b93c31e3142f810ca865c /crates/ra_hir/src/code_model_impl
parent90215eb5a026d446ae7e5d4e62c43d6d8c82edf1 (diff)
remove boilerplate
Diffstat (limited to 'crates/ra_hir/src/code_model_impl')
-rw-r--r--crates/ra_hir/src/code_model_impl/function.rs14
1 files changed, 1 insertions, 13 deletions
diff --git a/crates/ra_hir/src/code_model_impl/function.rs b/crates/ra_hir/src/code_model_impl/function.rs
index 6ce5c77b1..e0dd4d629 100644
--- a/crates/ra_hir/src/code_model_impl/function.rs
+++ b/crates/ra_hir/src/code_model_impl/function.rs
@@ -5,27 +5,15 @@ use std::sync::Arc;
5use ra_syntax::ast::{self, NameOwner}; 5use ra_syntax::ast::{self, NameOwner};
6 6
7use crate::{ 7use crate::{
8 HirDatabase, Name, AsName, Function, FnSignature, Module, HirFileId, 8 HirDatabase, Name, AsName, Function, FnSignature,
9 type_ref::{TypeRef, Mutability}, 9 type_ref::{TypeRef, Mutability},
10 expr::Body, 10 expr::Body,
11 impl_block::ImplBlock, 11 impl_block::ImplBlock,
12 ids::ItemLoc,
13}; 12};
14 13
15pub use self::scope::{FnScopes, ScopesWithSyntaxMapping, ScopeEntryWithSyntax}; 14pub use self::scope::{FnScopes, ScopesWithSyntaxMapping, ScopeEntryWithSyntax};
16 15
17impl Function { 16impl Function {
18 pub(crate) fn from_ast(
19 db: &impl HirDatabase,
20 module: Module,
21 file_id: HirFileId,
22 ast: &ast::FnDef,
23 ) -> Function {
24 let loc = ItemLoc::from_ast(db, module, file_id, ast);
25 let id = db.as_ref().fns.loc2id(&loc);
26 Function { id }
27 }
28
29 pub(crate) fn body(&self, db: &impl HirDatabase) -> Arc<Body> { 17 pub(crate) fn body(&self, db: &impl HirDatabase) -> Arc<Body> {
30 db.body_hir(*self) 18 db.body_hir(*self)
31 } 19 }