aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/completion
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-09-12 22:34:52 +0100
committerAleksey Kladov <[email protected]>2019-09-12 22:34:52 +0100
commit114a1b878e95c20490af574550ea0825b7a8f9d1 (patch)
tree3fe7cb05dc4d92d19ecbb87bfafc4a9ff202153e /crates/ra_ide_api/src/completion
parentbcf30d389c3744ab517372431eb7e1e1dfcc50df (diff)
rename AdtDef -> Adt
Diffstat (limited to 'crates/ra_ide_api/src/completion')
-rw-r--r--crates/ra_ide_api/src/completion/complete_dot.rs4
-rw-r--r--crates/ra_ide_api/src/completion/complete_path.rs8
-rw-r--r--crates/ra_ide_api/src/completion/complete_pattern.rs2
-rw-r--r--crates/ra_ide_api/src/completion/presentation.rs8
4 files changed, 10 insertions, 12 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_dot.rs b/crates/ra_ide_api/src/completion/complete_dot.rs
index 2325cdf08..9e64c8659 100644
--- a/crates/ra_ide_api/src/completion/complete_dot.rs
+++ b/crates/ra_ide_api/src/completion/complete_dot.rs
@@ -1,4 +1,4 @@
1use hir::{AdtDef, Ty, TypeCtor}; 1use hir::{Adt, Ty, TypeCtor};
2 2
3use crate::completion::completion_item::CompletionKind; 3use crate::completion::completion_item::CompletionKind;
4use crate::{ 4use crate::{
@@ -37,7 +37,7 @@ fn complete_fields(acc: &mut Completions, ctx: &CompletionContext, receiver: Ty)
37 for receiver in ctx.analyzer.autoderef(ctx.db, receiver) { 37 for receiver in ctx.analyzer.autoderef(ctx.db, receiver) {
38 if let Ty::Apply(a_ty) = receiver { 38 if let Ty::Apply(a_ty) = receiver {
39 match a_ty.ctor { 39 match a_ty.ctor {
40 TypeCtor::Adt(AdtDef::Struct(s)) => { 40 TypeCtor::Adt(Adt::Struct(s)) => {
41 for field in s.fields(ctx.db) { 41 for field in s.fields(ctx.db) {
42 acc.add_field(ctx, field, &a_ty.parameters); 42 acc.add_field(ctx, field, &a_ty.parameters);
43 } 43 }
diff --git a/crates/ra_ide_api/src/completion/complete_path.rs b/crates/ra_ide_api/src/completion/complete_path.rs
index df14f465a..4d3414f33 100644
--- a/crates/ra_ide_api/src/completion/complete_path.rs
+++ b/crates/ra_ide_api/src/completion/complete_path.rs
@@ -1,4 +1,4 @@
1use hir::{AdtDef, Either, Resolution}; 1use hir::{Adt, Either, Resolution};
2use ra_syntax::AstNode; 2use ra_syntax::AstNode;
3use test_utils::tested_by; 3use test_utils::tested_by;
4 4
@@ -37,14 +37,14 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) {
37 acc.add_resolution(ctx, name.to_string(), &res.def.map(hir::Resolution::Def)); 37 acc.add_resolution(ctx, name.to_string(), &res.def.map(hir::Resolution::Def));
38 } 38 }
39 } 39 }
40 hir::ModuleDef::AdtDef(_) | hir::ModuleDef::TypeAlias(_) => { 40 hir::ModuleDef::Adt(_) | hir::ModuleDef::TypeAlias(_) => {
41 if let hir::ModuleDef::AdtDef(AdtDef::Enum(e)) = def { 41 if let hir::ModuleDef::Adt(Adt::Enum(e)) = def {
42 for variant in e.variants(ctx.db) { 42 for variant in e.variants(ctx.db) {
43 acc.add_enum_variant(ctx, variant); 43 acc.add_enum_variant(ctx, variant);
44 } 44 }
45 } 45 }
46 let ty = match def { 46 let ty = match def {
47 hir::ModuleDef::AdtDef(adt) => adt.ty(ctx.db), 47 hir::ModuleDef::Adt(adt) => adt.ty(ctx.db),
48 hir::ModuleDef::TypeAlias(a) => a.ty(ctx.db), 48 hir::ModuleDef::TypeAlias(a) => a.ty(ctx.db),
49 _ => unreachable!(), 49 _ => unreachable!(),
50 }; 50 };
diff --git a/crates/ra_ide_api/src/completion/complete_pattern.rs b/crates/ra_ide_api/src/completion/complete_pattern.rs
index 05db973e4..fb7f9feb8 100644
--- a/crates/ra_ide_api/src/completion/complete_pattern.rs
+++ b/crates/ra_ide_api/src/completion/complete_pattern.rs
@@ -15,7 +15,7 @@ pub(super) fn complete_pattern(acc: &mut Completions, ctx: &CompletionContext) {
15 _ => continue, 15 _ => continue,
16 }; 16 };
17 match def { 17 match def {
18 hir::ModuleDef::AdtDef(hir::AdtDef::Enum(..)) 18 hir::ModuleDef::Adt(hir::Adt::Enum(..))
19 | hir::ModuleDef::EnumVariant(..) 19 | hir::ModuleDef::EnumVariant(..)
20 | hir::ModuleDef::Const(..) 20 | hir::ModuleDef::Const(..)
21 | hir::ModuleDef::Module(..) => (), 21 | hir::ModuleDef::Module(..) => (),
diff --git a/crates/ra_ide_api/src/completion/presentation.rs b/crates/ra_ide_api/src/completion/presentation.rs
index e9bf2b96d..95bbd34b7 100644
--- a/crates/ra_ide_api/src/completion/presentation.rs
+++ b/crates/ra_ide_api/src/completion/presentation.rs
@@ -67,15 +67,13 @@ impl Completions {
67 Resolution::Def(Function(func)) => { 67 Resolution::Def(Function(func)) => {
68 return self.add_function_with_name(ctx, Some(local_name), *func); 68 return self.add_function_with_name(ctx, Some(local_name), *func);
69 } 69 }
70 Resolution::Def(AdtDef(hir::AdtDef::Struct(it))) => { 70 Resolution::Def(Adt(hir::Adt::Struct(it))) => {
71 (CompletionItemKind::Struct, it.docs(ctx.db)) 71 (CompletionItemKind::Struct, it.docs(ctx.db))
72 } 72 }
73 Resolution::Def(AdtDef(hir::AdtDef::Union(it))) => { 73 Resolution::Def(Adt(hir::Adt::Union(it))) => {
74 (CompletionItemKind::Struct, it.docs(ctx.db)) 74 (CompletionItemKind::Struct, it.docs(ctx.db))
75 } 75 }
76 Resolution::Def(AdtDef(hir::AdtDef::Enum(it))) => { 76 Resolution::Def(Adt(hir::Adt::Enum(it))) => (CompletionItemKind::Enum, it.docs(ctx.db)),
77 (CompletionItemKind::Enum, it.docs(ctx.db))
78 }
79 Resolution::Def(EnumVariant(it)) => (CompletionItemKind::EnumVariant, it.docs(ctx.db)), 77 Resolution::Def(EnumVariant(it)) => (CompletionItemKind::EnumVariant, it.docs(ctx.db)),
80 Resolution::Def(Const(it)) => (CompletionItemKind::Const, it.docs(ctx.db)), 78 Resolution::Def(Const(it)) => (CompletionItemKind::Const, it.docs(ctx.db)),
81 Resolution::Def(Static(it)) => (CompletionItemKind::Static, it.docs(ctx.db)), 79 Resolution::Def(Static(it)) => (CompletionItemKind::Static, it.docs(ctx.db)),