aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/display/function_signature.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src/display/function_signature.rs')
-rw-r--r--crates/ra_ide/src/display/function_signature.rs17
1 files changed, 6 insertions, 11 deletions
diff --git a/crates/ra_ide/src/display/function_signature.rs b/crates/ra_ide/src/display/function_signature.rs
index 1e4a472b4..c23e08e9a 100644
--- a/crates/ra_ide/src/display/function_signature.rs
+++ b/crates/ra_ide/src/display/function_signature.rs
@@ -4,13 +4,11 @@ use std::fmt::{self, Display};
4 4
5use hir::{Docs, Documentation, HasSource, HirDisplay}; 5use hir::{Docs, Documentation, HasSource, HirDisplay};
6use join_to_string::join; 6use join_to_string::join;
7use ra_ide_db::RootDatabase;
7use ra_syntax::ast::{self, AstNode, NameOwner, VisibilityOwner}; 8use ra_syntax::ast::{self, AstNode, NameOwner, VisibilityOwner};
8use std::convert::From; 9use std::convert::From;
9 10
10use crate::{ 11use crate::display::{generic_parameters, where_predicates};
11 db,
12 display::{generic_parameters, where_predicates},
13};
14 12
15#[derive(Debug)] 13#[derive(Debug)]
16pub enum CallableKind { 14pub enum CallableKind {
@@ -48,13 +46,13 @@ impl FunctionSignature {
48 self 46 self
49 } 47 }
50 48
51 pub(crate) fn from_hir(db: &db::RootDatabase, function: hir::Function) -> Self { 49 pub(crate) fn from_hir(db: &RootDatabase, function: hir::Function) -> Self {
52 let doc = function.docs(db); 50 let doc = function.docs(db);
53 let ast_node = function.source(db).value; 51 let ast_node = function.source(db).value;
54 FunctionSignature::from(&ast_node).with_doc_opt(doc) 52 FunctionSignature::from(&ast_node).with_doc_opt(doc)
55 } 53 }
56 54
57 pub(crate) fn from_struct(db: &db::RootDatabase, st: hir::Struct) -> Option<Self> { 55 pub(crate) fn from_struct(db: &RootDatabase, st: hir::Struct) -> Option<Self> {
58 let node: ast::StructDef = st.source(db).value; 56 let node: ast::StructDef = st.source(db).value;
59 match node.kind() { 57 match node.kind() {
60 ast::StructKind::Record(_) => return None, 58 ast::StructKind::Record(_) => return None,
@@ -86,10 +84,7 @@ impl FunctionSignature {
86 ) 84 )
87 } 85 }
88 86
89 pub(crate) fn from_enum_variant( 87 pub(crate) fn from_enum_variant(db: &RootDatabase, variant: hir::EnumVariant) -> Option<Self> {
90 db: &db::RootDatabase,
91 variant: hir::EnumVariant,
92 ) -> Option<Self> {
93 let node: ast::EnumVariant = variant.source(db).value; 88 let node: ast::EnumVariant = variant.source(db).value;
94 match node.kind() { 89 match node.kind() {
95 ast::StructKind::Record(_) | ast::StructKind::Unit => return None, 90 ast::StructKind::Record(_) | ast::StructKind::Unit => return None,
@@ -126,7 +121,7 @@ impl FunctionSignature {
126 ) 121 )
127 } 122 }
128 123
129 pub(crate) fn from_macro(db: &db::RootDatabase, macro_def: hir::MacroDef) -> Option<Self> { 124 pub(crate) fn from_macro(db: &RootDatabase, macro_def: hir::MacroDef) -> Option<Self> {
130 let node: ast::MacroCall = macro_def.source(db).value; 125 let node: ast::MacroCall = macro_def.source(db).value;
131 126
132 let params = vec![]; 127 let params = vec![];