aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/completion
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api/src/completion')
-rw-r--r--crates/ra_ide_api/src/completion/complete_dot.rs7
-rw-r--r--crates/ra_ide_api/src/completion/complete_pattern.rs2
-rw-r--r--crates/ra_ide_api/src/completion/complete_scope.rs4
3 files changed, 6 insertions, 7 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_dot.rs b/crates/ra_ide_api/src/completion/complete_dot.rs
index 5bf289c63..0822a0e7e 100644
--- a/crates/ra_ide_api/src/completion/complete_dot.rs
+++ b/crates/ra_ide_api/src/completion/complete_dot.rs
@@ -16,8 +16,8 @@ pub(super) fn complete_dot(acc: &mut Completions, ctx: &CompletionContext) {
16 16
17fn complete_fields(acc: &mut Completions, ctx: &CompletionContext, receiver: Ty) { 17fn complete_fields(acc: &mut Completions, ctx: &CompletionContext, receiver: Ty) {
18 for receiver in receiver.autoderef(ctx.db) { 18 for receiver in receiver.autoderef(ctx.db) {
19 match receiver { 19 if let Ty::Apply(a_ty) = receiver {
20 Ty::Apply(a_ty) => match a_ty.ctor { 20 match a_ty.ctor {
21 TypeCtor::Adt(AdtDef::Struct(s)) => { 21 TypeCtor::Adt(AdtDef::Struct(s)) => {
22 for field in s.fields(ctx.db) { 22 for field in s.fields(ctx.db) {
23 acc.add_field(ctx, field, &a_ty.parameters); 23 acc.add_field(ctx, field, &a_ty.parameters);
@@ -30,8 +30,7 @@ fn complete_fields(acc: &mut Completions, ctx: &CompletionContext, receiver: Ty)
30 } 30 }
31 } 31 }
32 _ => {} 32 _ => {}
33 }, 33 }
34 _ => {}
35 }; 34 };
36 } 35 }
37} 36}
diff --git a/crates/ra_ide_api/src/completion/complete_pattern.rs b/crates/ra_ide_api/src/completion/complete_pattern.rs
index 74833a756..6655a05a7 100644
--- a/crates/ra_ide_api/src/completion/complete_pattern.rs
+++ b/crates/ra_ide_api/src/completion/complete_pattern.rs
@@ -10,7 +10,7 @@ pub(super) fn complete_pattern(acc: &mut Completions, ctx: &CompletionContext) {
10 let names = ctx.analyzer.all_names(ctx.db); 10 let names = ctx.analyzer.all_names(ctx.db);
11 for (name, res) in names.into_iter() { 11 for (name, res) in names.into_iter() {
12 let r = res.as_ref(); 12 let r = res.as_ref();
13 let def = match r.take_types().or(r.take_values()) { 13 let def = match r.take_types().or_else(|| r.take_values()) {
14 Some(hir::Resolution::Def(def)) => def, 14 Some(hir::Resolution::Def(def)) => def,
15 _ => continue, 15 _ => continue,
16 }; 16 };
diff --git a/crates/ra_ide_api/src/completion/complete_scope.rs b/crates/ra_ide_api/src/completion/complete_scope.rs
index 2473e58b4..0f8cfaae8 100644
--- a/crates/ra_ide_api/src/completion/complete_scope.rs
+++ b/crates/ra_ide_api/src/completion/complete_scope.rs
@@ -49,7 +49,7 @@ pub(super) fn complete_scope(acc: &mut Completions, ctx: &CompletionContext) {
49 } 49 }
50} 50}
51 51
52fn build_import_label(name: &str, path: &Vec<SmolStr>) -> String { 52fn build_import_label(name: &str, path: &[SmolStr]) -> String {
53 let mut buf = String::with_capacity(64); 53 let mut buf = String::with_capacity(64);
54 buf.push_str(name); 54 buf.push_str(name);
55 buf.push_str(" ("); 55 buf.push_str(" (");
@@ -58,7 +58,7 @@ fn build_import_label(name: &str, path: &Vec<SmolStr>) -> String {
58 buf 58 buf
59} 59}
60 60
61fn fmt_import_path(path: &Vec<SmolStr>, buf: &mut String) { 61fn fmt_import_path(path: &[SmolStr], buf: &mut String) {
62 let mut segments = path.iter(); 62 let mut segments = path.iter();
63 if let Some(s) = segments.next() { 63 if let Some(s) = segments.next() {
64 buf.push_str(&s); 64 buf.push_str(&s);