aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorKevin DeLorey <[email protected]>2020-02-11 16:04:30 +0000
committerKevin DeLorey <[email protected]>2020-02-11 16:04:30 +0000
commit47d314e85681c075ff859e13343927e7406e1b46 (patch)
treee5c864418c92045be5ca7459479a54ff4bd5ad82 /crates
parente664cd73e3f91086dc765fb5ec74ebec2daa8ffa (diff)
Fixing minor suggestions and added module level documentation.
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_assists/src/utils.rs3
-rw-r--r--crates/ra_ide/src/completion/complete_trait_impl.rs15
2 files changed, 7 insertions, 11 deletions
diff --git a/crates/ra_assists/src/utils.rs b/crates/ra_assists/src/utils.rs
index 1280a4fdc..6ff44c95c 100644
--- a/crates/ra_assists/src/utils.rs
+++ b/crates/ra_assists/src/utils.rs
@@ -6,7 +6,6 @@ use ra_syntax::{
6}; 6};
7 7
8use hir::db::HirDatabase; 8use hir::db::HirDatabase;
9
10use rustc_hash::FxHashSet; 9use rustc_hash::FxHashSet;
11 10
12pub fn get_missing_impl_items( 11pub fn get_missing_impl_items(
@@ -55,7 +54,7 @@ pub fn get_missing_impl_items(
55 .map(|n| !impl_fns_consts.contains(&n.to_string())) 54 .map(|n| !impl_fns_consts.contains(&n.to_string()))
56 .unwrap_or_default(), 55 .unwrap_or_default(),
57 }) 56 })
58 .map(|i| i.clone()) 57 .cloned()
59 .collect() 58 .collect()
60 }) 59 })
61} 60}
diff --git a/crates/ra_ide/src/completion/complete_trait_impl.rs b/crates/ra_ide/src/completion/complete_trait_impl.rs
index bea3ce106..f2661b623 100644
--- a/crates/ra_ide/src/completion/complete_trait_impl.rs
+++ b/crates/ra_ide/src/completion/complete_trait_impl.rs
@@ -1,5 +1,8 @@
1use crate::completion::{ 1//! FIXME: write short doc here
2 CompletionContext, CompletionItem, CompletionItemKind, CompletionKind, Completions, 2
3use crate::{
4 completion::{CompletionContext, CompletionItem, CompletionItemKind, CompletionKind, Completions},
5 display::FunctionSignature,
3}; 6};
4 7
5use hir::{self, Docs, HasSource}; 8use hir::{self, Docs, HasSource};
@@ -29,8 +32,6 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext
29} 32}
30 33
31fn add_function_impl(acc: &mut Completions, ctx: &CompletionContext, func: &hir::Function) { 34fn add_function_impl(acc: &mut Completions, ctx: &CompletionContext, func: &hir::Function) {
32 use crate::display::FunctionSignature;
33
34 let display = FunctionSignature::from_hir(ctx.db, func.clone()); 35 let display = FunctionSignature::from_hir(ctx.db, func.clone());
35 36
36 let func_name = func.name(ctx.db); 37 let func_name = func.name(ctx.db);
@@ -51,11 +52,7 @@ fn add_function_impl(acc: &mut Completions, ctx: &CompletionContext, func: &hir:
51 CompletionItemKind::Function 52 CompletionItemKind::Function
52 }; 53 };
53 54
54 let snippet = { 55 let snippet = format!("{} {{}}", display);
55 let mut s = format!("{}", display);
56 s.push_str(" {}");
57 s
58 };
59 56
60 builder.insert_text(snippet).kind(completion_kind).add_to(acc); 57 builder.insert_text(snippet).kind(completion_kind).add_to(acc);
61} 58}