aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-12-08 16:50:43 +0000
committerAleksey Kladov <[email protected]>2019-12-08 16:50:43 +0000
commit61c3887b70820283cb759127e3aecf7cbdbdc8c1 (patch)
treed122e4c39550e930ab0ec03fe8cd3aab7c619a73
parenta1639d0d1ef201b2b9a425eddecfb41a25f10931 (diff)
Remove one more Ty
-rw-r--r--crates/ra_hir/src/code_model.rs5
-rw-r--r--crates/ra_hir/src/source_binder.rs4
-rw-r--r--crates/ra_ide/src/completion/complete_dot.rs2
3 files changed, 3 insertions, 8 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs
index fd30971b0..c013ff99b 100644
--- a/crates/ra_hir/src/code_model.rs
+++ b/crates/ra_hir/src/code_model.rs
@@ -986,11 +986,6 @@ impl Type {
986 None 986 None
987 } 987 }
988 988
989 // FIXME: remove
990 pub fn into_ty(self) -> Ty {
991 self.ty.value
992 }
993
994 pub fn as_adt(&self) -> Option<Adt> { 989 pub fn as_adt(&self) -> Option<Adt> {
995 let (adt, _subst) = self.ty.value.as_adt()?; 990 let (adt, _subst) = self.ty.value.as_adt()?;
996 Some(adt.into()) 991 Some(adt.into())
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs
index 9efd0477c..44d185003 100644
--- a/crates/ra_hir/src/source_binder.rs
+++ b/crates/ra_hir/src/source_binder.rs
@@ -427,7 +427,7 @@ impl SourceAnalyzer {
427 427
428 /// Checks that particular type `ty` implements `std::future::Future`. 428 /// Checks that particular type `ty` implements `std::future::Future`.
429 /// This function is used in `.await` syntax completion. 429 /// This function is used in `.await` syntax completion.
430 pub fn impls_future(&self, db: &impl HirDatabase, ty: Ty) -> bool { 430 pub fn impls_future(&self, db: &impl HirDatabase, ty: Type) -> bool {
431 let std_future_path = known::std_future_future(); 431 let std_future_path = known::std_future_future();
432 432
433 let std_future_trait = match self.resolver.resolve_known_trait(db, &std_future_path) { 433 let std_future_trait = match self.resolver.resolve_known_trait(db, &std_future_path) {
@@ -440,7 +440,7 @@ impl SourceAnalyzer {
440 _ => return false, 440 _ => return false,
441 }; 441 };
442 442
443 let canonical_ty = Canonical { value: ty, num_vars: 0 }; 443 let canonical_ty = Canonical { value: ty.ty.value, num_vars: 0 };
444 implements_trait(&canonical_ty, db, &self.resolver, krate.into(), std_future_trait) 444 implements_trait(&canonical_ty, db, &self.resolver, krate.into(), std_future_trait)
445 } 445 }
446 446
diff --git a/crates/ra_ide/src/completion/complete_dot.rs b/crates/ra_ide/src/completion/complete_dot.rs
index a52eb0ee4..294964887 100644
--- a/crates/ra_ide/src/completion/complete_dot.rs
+++ b/crates/ra_ide/src/completion/complete_dot.rs
@@ -27,7 +27,7 @@ pub(super) fn complete_dot(acc: &mut Completions, ctx: &CompletionContext) {
27 complete_methods(acc, ctx, &receiver_ty); 27 complete_methods(acc, ctx, &receiver_ty);
28 28
29 // Suggest .await syntax for types that implement Future trait 29 // Suggest .await syntax for types that implement Future trait
30 if ctx.analyzer.impls_future(ctx.db, receiver_ty.into_ty()) { 30 if ctx.analyzer.impls_future(ctx.db, receiver_ty) {
31 CompletionItem::new(CompletionKind::Keyword, ctx.source_range(), "await") 31 CompletionItem::new(CompletionKind::Keyword, ctx.source_range(), "await")
32 .detail("expr.await") 32 .detail("expr.await")
33 .insert_text("await") 33 .insert_text("await")