From 47d314e85681c075ff859e13343927e7406e1b46 Mon Sep 17 00:00:00 2001 From: Kevin DeLorey <2295721+kdelorey@users.noreply.github.com> Date: Tue, 11 Feb 2020 10:04:30 -0600 Subject: Fixing minor suggestions and added module level documentation. --- crates/ra_assists/src/utils.rs | 3 +-- crates/ra_ide/src/completion/complete_trait_impl.rs | 15 ++++++--------- 2 files changed, 7 insertions(+), 11 deletions(-) (limited to 'crates') 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::{ }; use hir::db::HirDatabase; - use rustc_hash::FxHashSet; pub fn get_missing_impl_items( @@ -55,7 +54,7 @@ pub fn get_missing_impl_items( .map(|n| !impl_fns_consts.contains(&n.to_string())) .unwrap_or_default(), }) - .map(|i| i.clone()) + .cloned() .collect() }) } 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 @@ -use crate::completion::{ - CompletionContext, CompletionItem, CompletionItemKind, CompletionKind, Completions, +//! FIXME: write short doc here + +use crate::{ + completion::{CompletionContext, CompletionItem, CompletionItemKind, CompletionKind, Completions}, + display::FunctionSignature, }; use hir::{self, Docs, HasSource}; @@ -29,8 +32,6 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext } fn add_function_impl(acc: &mut Completions, ctx: &CompletionContext, func: &hir::Function) { - use crate::display::FunctionSignature; - let display = FunctionSignature::from_hir(ctx.db, func.clone()); let func_name = func.name(ctx.db); @@ -51,11 +52,7 @@ fn add_function_impl(acc: &mut Completions, ctx: &CompletionContext, func: &hir: CompletionItemKind::Function }; - let snippet = { - let mut s = format!("{}", display); - s.push_str(" {}"); - s - }; + let snippet = format!("{} {{}}", display); builder.insert_text(snippet).kind(completion_kind).add_to(acc); } -- cgit v1.2.3