diff options
Diffstat (limited to 'crates/ra_ide/src/completion')
-rw-r--r-- | crates/ra_ide/src/completion/complete_trait_impl.rs | 8 | ||||
-rw-r--r-- | crates/ra_ide/src/completion/completion_item.rs | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/crates/ra_ide/src/completion/complete_trait_impl.rs b/crates/ra_ide/src/completion/complete_trait_impl.rs index 6ff10c017..83628e35c 100644 --- a/crates/ra_ide/src/completion/complete_trait_impl.rs +++ b/crates/ra_ide/src/completion/complete_trait_impl.rs | |||
@@ -59,7 +59,7 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext | |||
59 | .as_ref() | 59 | .as_ref() |
60 | .and_then(|node| node.parent()) | 60 | .and_then(|node| node.parent()) |
61 | .and_then(|node| node.parent()) | 61 | .and_then(|node| node.parent()) |
62 | .and_then(|node| ast::ImplBlock::cast(node)); | 62 | .and_then(ast::ImplBlock::cast); |
63 | 63 | ||
64 | if let (Some(trigger), Some(impl_block)) = (trigger, impl_block) { | 64 | if let (Some(trigger), Some(impl_block)) = (trigger, impl_block) { |
65 | match trigger.kind() { | 65 | match trigger.kind() { |
@@ -110,17 +110,17 @@ fn add_function_impl( | |||
110 | ctx: &CompletionContext, | 110 | ctx: &CompletionContext, |
111 | func: &hir::Function, | 111 | func: &hir::Function, |
112 | ) { | 112 | ) { |
113 | let display = FunctionSignature::from_hir(ctx.db, func.clone()); | 113 | let display = FunctionSignature::from_hir(ctx.db, *func); |
114 | 114 | ||
115 | let fn_name = func.name(ctx.db).to_string(); | 115 | let fn_name = func.name(ctx.db).to_string(); |
116 | 116 | ||
117 | let label = if func.params(ctx.db).len() > 0 { | 117 | let label = if !func.params(ctx.db).is_empty() { |
118 | format!("fn {}(..)", fn_name) | 118 | format!("fn {}(..)", fn_name) |
119 | } else { | 119 | } else { |
120 | format!("fn {}()", fn_name) | 120 | format!("fn {}()", fn_name) |
121 | }; | 121 | }; |
122 | 122 | ||
123 | let builder = CompletionItem::new(CompletionKind::Magic, ctx.source_range(), label.clone()) | 123 | let builder = CompletionItem::new(CompletionKind::Magic, ctx.source_range(), label) |
124 | .lookup_by(fn_name) | 124 | .lookup_by(fn_name) |
125 | .set_documentation(func.docs(ctx.db)); | 125 | .set_documentation(func.docs(ctx.db)); |
126 | 126 | ||
diff --git a/crates/ra_ide/src/completion/completion_item.rs b/crates/ra_ide/src/completion/completion_item.rs index 93f336370..61867c0ff 100644 --- a/crates/ra_ide/src/completion/completion_item.rs +++ b/crates/ra_ide/src/completion/completion_item.rs | |||
@@ -159,7 +159,7 @@ impl CompletionItem { | |||
159 | 159 | ||
160 | /// Short one-line additional information, like a type | 160 | /// Short one-line additional information, like a type |
161 | pub fn detail(&self) -> Option<&str> { | 161 | pub fn detail(&self) -> Option<&str> { |
162 | self.detail.as_ref().map(|it| it.as_str()) | 162 | self.detail.as_deref() |
163 | } | 163 | } |
164 | /// A doc-comment | 164 | /// A doc-comment |
165 | pub fn documentation(&self) -> Option<Documentation> { | 165 | pub fn documentation(&self) -> Option<Documentation> { |
@@ -167,7 +167,7 @@ impl CompletionItem { | |||
167 | } | 167 | } |
168 | /// What string is used for filtering. | 168 | /// What string is used for filtering. |
169 | pub fn lookup(&self) -> &str { | 169 | pub fn lookup(&self) -> &str { |
170 | self.lookup.as_ref().map(|it| it.as_str()).unwrap_or_else(|| self.label()) | 170 | self.lookup.as_deref().unwrap_or_else(|| self.label()) |
171 | } | 171 | } |
172 | 172 | ||
173 | pub fn kind(&self) -> Option<CompletionItemKind> { | 173 | pub fn kind(&self) -> Option<CompletionItemKind> { |