aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/completion
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-02-06 21:11:24 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-02-06 21:11:24 +0000
commita69ee774ca39f1300bd9dd7eb34b632db9098e26 (patch)
tree9da7f488f6564ac7f84d54ae9fc7296bcf2460e4 /crates/ra_ide_api/src/completion
parentc1e10a24fa3ba2b03a738afd8e1f7f472a12e29f (diff)
parent6753051a45e067fb8267f7ecbbf1b894558718d1 (diff)
Merge #754
754: Some clippy things r=matklad a=kjeremy Co-authored-by: kjeremy <[email protected]>
Diffstat (limited to 'crates/ra_ide_api/src/completion')
-rw-r--r--crates/ra_ide_api/src/completion/completion_context.rs9
-rw-r--r--crates/ra_ide_api/src/completion/completion_item.rs6
2 files changed, 6 insertions, 9 deletions
diff --git a/crates/ra_ide_api/src/completion/completion_context.rs b/crates/ra_ide_api/src/completion/completion_context.rs
index 5d1851da6..8abab0221 100644
--- a/crates/ra_ide_api/src/completion/completion_context.rs
+++ b/crates/ra_ide_api/src/completion/completion_context.rs
@@ -130,12 +130,9 @@ impl<'a> CompletionContext<'a> {
130 .ancestors() 130 .ancestors()
131 .take_while(|it| it.kind() != SOURCE_FILE && it.kind() != MODULE) 131 .take_while(|it| it.kind() != SOURCE_FILE && it.kind() != MODULE)
132 .find_map(ast::FnDef::cast); 132 .find_map(ast::FnDef::cast);
133 match (self.module, self.function_syntax) { 133 if let (Some(module), Some(fn_def)) = (self.module, self.function_syntax) {
134 (Some(module), Some(fn_def)) => { 134 let function = source_binder::function_from_module(self.db, module, fn_def);
135 let function = source_binder::function_from_module(self.db, module, fn_def); 135 self.function = Some(function);
136 self.function = Some(function);
137 }
138 _ => (),
139 } 136 }
140 137
141 let parent = match name_ref.syntax().parent() { 138 let parent = match name_ref.syntax().parent() {
diff --git a/crates/ra_ide_api/src/completion/completion_item.rs b/crates/ra_ide_api/src/completion/completion_item.rs
index bada6a33b..92e6e78bf 100644
--- a/crates/ra_ide_api/src/completion/completion_item.rs
+++ b/crates/ra_ide_api/src/completion/completion_item.rs
@@ -108,11 +108,11 @@ impl CompletionItem {
108 self.lookup 108 self.lookup
109 .as_ref() 109 .as_ref()
110 .map(|it| it.as_str()) 110 .map(|it| it.as_str())
111 .unwrap_or(self.label()) 111 .unwrap_or_else(|| self.label())
112 } 112 }
113 113
114 pub fn insert_text_format(&self) -> InsertTextFormat { 114 pub fn insert_text_format(&self) -> InsertTextFormat {
115 self.insert_text_format.clone() 115 self.insert_text_format
116 } 116 }
117 pub fn insert_text(&self) -> String { 117 pub fn insert_text(&self) -> String {
118 match &self.insert_text { 118 match &self.insert_text {
@@ -217,7 +217,7 @@ impl Builder {
217 let def = resolution 217 let def = resolution
218 .as_ref() 218 .as_ref()
219 .take_types() 219 .take_types()
220 .or(resolution.as_ref().take_values()); 220 .or_else(|| resolution.as_ref().take_values());
221 let def = match def { 221 let def = match def {
222 None => return self, 222 None => return self,
223 Some(it) => it, 223 Some(it) => it,