mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 05:45:12 +00:00
remove boilerplate
This commit is contained in:
parent
90215eb5a0
commit
f588535273
6 changed files with 73 additions and 93 deletions
|
@ -5,27 +5,15 @@ use std::sync::Arc;
|
|||
use ra_syntax::ast::{self, NameOwner};
|
||||
|
||||
use crate::{
|
||||
HirDatabase, Name, AsName, Function, FnSignature, Module, HirFileId,
|
||||
HirDatabase, Name, AsName, Function, FnSignature,
|
||||
type_ref::{TypeRef, Mutability},
|
||||
expr::Body,
|
||||
impl_block::ImplBlock,
|
||||
ids::ItemLoc,
|
||||
};
|
||||
|
||||
pub use self::scope::{FnScopes, ScopesWithSyntaxMapping, ScopeEntryWithSyntax};
|
||||
|
||||
impl Function {
|
||||
pub(crate) fn from_ast(
|
||||
db: &impl HirDatabase,
|
||||
module: Module,
|
||||
file_id: HirFileId,
|
||||
ast: &ast::FnDef,
|
||||
) -> Function {
|
||||
let loc = ItemLoc::from_ast(db, module, file_id, ast);
|
||||
let id = db.as_ref().fns.loc2id(&loc);
|
||||
Function { id }
|
||||
}
|
||||
|
||||
pub(crate) fn body(&self, db: &impl HirDatabase) -> Arc<Body> {
|
||||
db.body_hir(*self)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue