diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-12 08:41:16 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-12 08:41:16 +0000 |
commit | c01ef6eabab1fa70d3fdfed9c565fadec9f0a5ed (patch) | |
tree | 37160de8384855fd5fadce3ca4a3de4dacdf98b8 /crates/ide_completion/src/render/function.rs | |
parent | db6364fecc2b0e9a95d9aaece820a86265b4cb4f (diff) | |
parent | 99c4a41cd1a9f9ef0ee4f067f0069a23123b949a (diff) |
Merge #7974
7974: use references in CompletionItem's builder r=matklad a=yonip23
@matklad
This is a follow up to [this pr](https://github.com/rust-analyzer/rust-analyzer/pull/7973)
Co-authored-by: yonip23 <[email protected]>
Diffstat (limited to 'crates/ide_completion/src/render/function.rs')
-rw-r--r-- | crates/ide_completion/src/render/function.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/crates/ide_completion/src/render/function.rs b/crates/ide_completion/src/render/function.rs index 5931945a8..1e2f45f14 100644 --- a/crates/ide_completion/src/render/function.rs +++ b/crates/ide_completion/src/render/function.rs | |||
@@ -41,7 +41,12 @@ impl<'a> FunctionRender<'a> { | |||
41 | 41 | ||
42 | fn render(self, import_to_add: Option<ImportEdit>) -> CompletionItem { | 42 | fn render(self, import_to_add: Option<ImportEdit>) -> CompletionItem { |
43 | let params = self.params(); | 43 | let params = self.params(); |
44 | CompletionItem::new(CompletionKind::Reference, self.ctx.source_range(), self.name.clone()) | 44 | let mut builder = CompletionItem::new( |
45 | CompletionKind::Reference, | ||
46 | self.ctx.source_range(), | ||
47 | self.name.clone(), | ||
48 | ); | ||
49 | builder | ||
45 | .kind(self.kind()) | 50 | .kind(self.kind()) |
46 | .set_documentation(self.ctx.docs(self.func)) | 51 | .set_documentation(self.ctx.docs(self.func)) |
47 | .set_deprecated( | 52 | .set_deprecated( |
@@ -49,8 +54,9 @@ impl<'a> FunctionRender<'a> { | |||
49 | ) | 54 | ) |
50 | .detail(self.detail()) | 55 | .detail(self.detail()) |
51 | .add_call_parens(self.ctx.completion, self.name, params) | 56 | .add_call_parens(self.ctx.completion, self.name, params) |
52 | .add_import(import_to_add) | 57 | .add_import(import_to_add); |
53 | .build() | 58 | |
59 | builder.build() | ||
54 | } | 60 | } |
55 | 61 | ||
56 | fn detail(&self) -> String { | 62 | fn detail(&self) -> String { |