aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/source_binder.rs
diff options
context:
space:
mode:
authorEvgenii P <[email protected]>2019-08-02 19:16:20 +0100
committerEvgenii P <[email protected]>2019-08-02 19:16:20 +0100
commit30bc3b93bec06256350b66869f2885ee71c3bedd (patch)
tree87422290ad2ea1a85f1805a2e9431b2983f0974c /crates/ra_hir/src/source_binder.rs
parentc417b98f02004a10819111903882482b39e50d17 (diff)
rustfmt
Diffstat (limited to 'crates/ra_hir/src/source_binder.rs')
-rw-r--r--crates/ra_hir/src/source_binder.rs23
1 files changed, 13 insertions, 10 deletions
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs
index 8496b143a..67cb19615 100644
--- a/crates/ra_hir/src/source_binder.rs
+++ b/crates/ra_hir/src/source_binder.rs
@@ -23,8 +23,8 @@ use crate::{
23 scope::{ExprScopes, ScopeId}, 23 scope::{ExprScopes, ScopeId},
24 BodySourceMap, 24 BodySourceMap,
25 }, 25 },
26 ty::method_resolution::implements_trait,
27 ids::LocationCtx, 26 ids::LocationCtx,
27 ty::method_resolution::implements_trait,
28 AsName, AstId, Const, Crate, DefWithBody, Either, Enum, Function, HirDatabase, HirFileId, 28 AsName, AstId, Const, Crate, DefWithBody, Either, Enum, Function, HirDatabase, HirFileId,
29 MacroDef, Module, Name, Path, PerNs, Resolver, Static, Struct, Trait, Ty, 29 MacroDef, Module, Name, Path, PerNs, Resolver, Static, Struct, Trait, Ty,
30}; 30};
@@ -414,22 +414,25 @@ impl SourceAnalyzer {
414 /// This function is used in `.await` syntax completion. 414 /// This function is used in `.await` syntax completion.
415 pub fn impls_future(&self, db: &impl HirDatabase, ty: Ty) -> bool { 415 pub fn impls_future(&self, db: &impl HirDatabase, ty: Ty) -> bool {
416 // Search for std::future::Future trait in scope 416 // Search for std::future::Future trait in scope
417 let future_trait = self.resolver.traits_in_scope(db) 417 let future_trait = self
418 .resolver
419 .traits_in_scope(db)
418 .into_iter() 420 .into_iter()
419 .filter(|t| { 421 .filter(|t| {
420 let std = t.module(db).parent(db) 422 let std = t
421 .and_then(|m| m 423 .module(db)
422 .name(db) 424 .parent(db)
423 .and_then(|n| Some(n.to_string() == "std"))) 425 .and_then(|m| m.name(db).and_then(|n| Some(n.to_string() == "std")))
424 .unwrap_or(false); 426 .unwrap_or(false);
425 427
426 let future = t.module(db).name(db) 428 let future = t
429 .module(db)
430 .name(db)
427 .and_then(|n| Some(n.to_string() == "future")) 431 .and_then(|n| Some(n.to_string() == "future"))
428 .unwrap_or(false); 432 .unwrap_or(false);
429 433
430 let future_trait = t.name(db) 434 let future_trait =
431 .and_then(|n| Some(n.to_string() == "Future")) 435 t.name(db).and_then(|n| Some(n.to_string() == "Future")).unwrap_or(false);
432 .unwrap_or(false);
433 436
434 std && future && future_trait 437 std && future && future_trait
435 }) 438 })