diff options
author | Kevin DeLorey <[email protected]> | 2020-02-09 16:25:47 +0000 |
---|---|---|
committer | Kevin DeLorey <[email protected]> | 2020-02-09 16:37:43 +0000 |
commit | a957c473fdb79880c39b73dc9e0c923093cf16ac (patch) | |
tree | f998b548f530ce604651e0e6af314ed2ec74b3b5 /crates/ra_ide/src/display/function_signature.rs | |
parent | 22caf982b99c54058e2e9200aeea0e61cada284a (diff) | |
parent | 1b9b13b4b4a75b5531c3f046ce6bf72d681f2732 (diff) |
Merge branch 'master' into kdelorey/complete-trait-impl
Diffstat (limited to 'crates/ra_ide/src/display/function_signature.rs')
-rw-r--r-- | crates/ra_ide/src/display/function_signature.rs | 17 |
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 | ||
5 | use hir::{Docs, Documentation, HasSource, HirDisplay}; | 5 | use hir::{Docs, Documentation, HasSource, HirDisplay}; |
6 | use join_to_string::join; | 6 | use join_to_string::join; |
7 | use ra_ide_db::RootDatabase; | ||
7 | use ra_syntax::ast::{self, AstNode, NameOwner, VisibilityOwner}; | 8 | use ra_syntax::ast::{self, AstNode, NameOwner, VisibilityOwner}; |
8 | use std::convert::From; | 9 | use std::convert::From; |
9 | 10 | ||
10 | use crate::{ | 11 | use crate::display::{generic_parameters, where_predicates}; |
11 | db, | ||
12 | display::{generic_parameters, where_predicates}, | ||
13 | }; | ||
14 | 12 | ||
15 | #[derive(Debug)] | 13 | #[derive(Debug)] |
16 | pub enum CallableKind { | 14 | pub 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![]; |