mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 05:15:04 +00:00
Remove one more Ty
This commit is contained in:
parent
a1639d0d1e
commit
61c3887b70
3 changed files with 3 additions and 8 deletions
|
@ -986,11 +986,6 @@ impl Type {
|
|||
None
|
||||
}
|
||||
|
||||
// FIXME: remove
|
||||
pub fn into_ty(self) -> Ty {
|
||||
self.ty.value
|
||||
}
|
||||
|
||||
pub fn as_adt(&self) -> Option<Adt> {
|
||||
let (adt, _subst) = self.ty.value.as_adt()?;
|
||||
Some(adt.into())
|
||||
|
|
|
@ -427,7 +427,7 @@ impl SourceAnalyzer {
|
|||
|
||||
/// Checks that particular type `ty` implements `std::future::Future`.
|
||||
/// This function is used in `.await` syntax completion.
|
||||
pub fn impls_future(&self, db: &impl HirDatabase, ty: Ty) -> bool {
|
||||
pub fn impls_future(&self, db: &impl HirDatabase, ty: Type) -> bool {
|
||||
let std_future_path = known::std_future_future();
|
||||
|
||||
let std_future_trait = match self.resolver.resolve_known_trait(db, &std_future_path) {
|
||||
|
@ -440,7 +440,7 @@ impl SourceAnalyzer {
|
|||
_ => return false,
|
||||
};
|
||||
|
||||
let canonical_ty = Canonical { value: ty, num_vars: 0 };
|
||||
let canonical_ty = Canonical { value: ty.ty.value, num_vars: 0 };
|
||||
implements_trait(&canonical_ty, db, &self.resolver, krate.into(), std_future_trait)
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ pub(super) fn complete_dot(acc: &mut Completions, ctx: &CompletionContext) {
|
|||
complete_methods(acc, ctx, &receiver_ty);
|
||||
|
||||
// Suggest .await syntax for types that implement Future trait
|
||||
if ctx.analyzer.impls_future(ctx.db, receiver_ty.into_ty()) {
|
||||
if ctx.analyzer.impls_future(ctx.db, receiver_ty) {
|
||||
CompletionItem::new(CompletionKind::Keyword, ctx.source_range(), "await")
|
||||
.detail("expr.await")
|
||||
.insert_text("await")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue