aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/completion/completion_context.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-02-17 18:47:09 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-02-17 18:47:09 +0000
commita725dd4f7ac2b88541189f0f726ce86876c36add (patch)
tree9f6c056d06c839fac365767ad3070b23a35ba2bc /crates/ra_ide_api/src/completion/completion_context.rs
parent646b53ace30660935641932c043301e3cdd4e71f (diff)
parente503ffe9ff175aa5f35facb107fcd985a8b1c4a4 (diff)
Merge #849
849: Don't render `()` in calls to assoc functions r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide_api/src/completion/completion_context.rs')
-rw-r--r--crates/ra_ide_api/src/completion/completion_context.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/crates/ra_ide_api/src/completion/completion_context.rs b/crates/ra_ide_api/src/completion/completion_context.rs
index 82bd4d606..b9f0abe19 100644
--- a/crates/ra_ide_api/src/completion/completion_context.rs
+++ b/crates/ra_ide_api/src/completion/completion_context.rs
@@ -137,6 +137,13 @@ impl<'a> CompletionContext<'a> {
137 }; 137 };
138 if let Some(segment) = ast::PathSegment::cast(parent) { 138 if let Some(segment) = ast::PathSegment::cast(parent) {
139 let path = segment.parent_path(); 139 let path = segment.parent_path();
140 self.is_call = path
141 .syntax()
142 .parent()
143 .and_then(ast::PathExpr::cast)
144 .and_then(|it| it.syntax().parent().and_then(ast::CallExpr::cast))
145 .is_some();
146
140 if let Some(mut path) = hir::Path::from_ast(path) { 147 if let Some(mut path) = hir::Path::from_ast(path) {
141 if !path.is_ident() { 148 if !path.is_ident() {
142 path.segments.pop().unwrap(); 149 path.segments.pop().unwrap();
@@ -176,12 +183,6 @@ impl<'a> CompletionContext<'a> {
176 } 183 }
177 } 184 }
178 } 185 }
179 self.is_call = path
180 .syntax()
181 .parent()
182 .and_then(ast::PathExpr::cast)
183 .and_then(|it| it.syntax().parent().and_then(ast::CallExpr::cast))
184 .is_some()
185 } 186 }
186 if let Some(field_expr) = ast::FieldExpr::cast(parent) { 187 if let Some(field_expr) = ast::FieldExpr::cast(parent) {
187 // The receiver comes before the point of insertion of the fake 188 // The receiver comes before the point of insertion of the fake