diff options
Diffstat (limited to 'crates/completion/src/render/function.rs')
-rw-r--r-- | crates/completion/src/render/function.rs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/crates/completion/src/render/function.rs b/crates/completion/src/render/function.rs index 16f15e22c..d22081236 100644 --- a/crates/completion/src/render/function.rs +++ b/crates/completion/src/render/function.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | use hir::{Documentation, HasAttrs, HasSource, Type}; | 1 | use hir::{HasSource, Type}; |
2 | use syntax::{ast::Fn, display::function_declaration}; | 2 | use syntax::{ast::Fn, display::function_declaration}; |
3 | 3 | ||
4 | use crate::{ | 4 | use crate::{ |
@@ -30,7 +30,7 @@ impl<'a> FunctionRender<'a> { | |||
30 | let params = self.params(); | 30 | let params = self.params(); |
31 | CompletionItem::new(CompletionKind::Reference, self.ctx.source_range(), self.name.clone()) | 31 | CompletionItem::new(CompletionKind::Reference, self.ctx.source_range(), self.name.clone()) |
32 | .kind(self.kind()) | 32 | .kind(self.kind()) |
33 | .set_documentation(self.docs()) | 33 | .set_documentation(self.ctx.docs(self.fn_)) |
34 | .set_deprecated(self.ctx.is_deprecated(self.fn_)) | 34 | .set_deprecated(self.ctx.is_deprecated(self.fn_)) |
35 | .detail(self.detail()) | 35 | .detail(self.detail()) |
36 | .add_call_parens(self.ctx.completion, self.name, params) | 36 | .add_call_parens(self.ctx.completion, self.name, params) |
@@ -45,8 +45,8 @@ impl<'a> FunctionRender<'a> { | |||
45 | if let Some(derefed_ty) = ty.remove_ref() { | 45 | if let Some(derefed_ty) = ty.remove_ref() { |
46 | for (name, local) in self.ctx.completion.locals.iter() { | 46 | for (name, local) in self.ctx.completion.locals.iter() { |
47 | if name == arg && local.ty(self.ctx.db()) == derefed_ty { | 47 | if name == arg && local.ty(self.ctx.db()) == derefed_ty { |
48 | return (if ty.is_mutable_reference() { "&mut " } else { "&" }).to_string() | 48 | let mutability = if ty.is_mutable_reference() { "&mut " } else { "&" }; |
49 | + &arg.to_string(); | 49 | return format!("{}{}", mutability, arg); |
50 | } | 50 | } |
51 | } | 51 | } |
52 | } | 52 | } |
@@ -80,8 +80,4 @@ impl<'a> FunctionRender<'a> { | |||
80 | CompletionItemKind::Function | 80 | CompletionItemKind::Function |
81 | } | 81 | } |
82 | } | 82 | } |
83 | |||
84 | fn docs(&self) -> Option<Documentation> { | ||
85 | self.fn_.docs(self.ctx.db()) | ||
86 | } | ||
87 | } | 83 | } |