aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/utils.rs
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2019-12-13 20:43:53 +0000
committerFlorian Diebold <[email protected]>2019-12-13 21:33:37 +0000
commit259c42f00e2e85594c7373166bc8467ce375a045 (patch)
treee3c3c855a4bcb7ba425f9d788a9a383a529557c3 /crates/ra_hir_ty/src/utils.rs
parent169fe4932f84f396965a4814c44e31061673937c (diff)
Add macros for known names and paths
Diffstat (limited to 'crates/ra_hir_ty/src/utils.rs')
-rw-r--r--crates/ra_hir_ty/src/utils.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/crates/ra_hir_ty/src/utils.rs b/crates/ra_hir_ty/src/utils.rs
index aeb211a91..fabf45b53 100644
--- a/crates/ra_hir_ty/src/utils.rs
+++ b/crates/ra_hir_ty/src/utils.rs
@@ -10,10 +10,8 @@ use hir_def::{
10 type_ref::TypeRef, 10 type_ref::TypeRef,
11 ContainerId, GenericDefId, Lookup, TraitId, TypeAliasId, TypeParamId, VariantId, 11 ContainerId, GenericDefId, Lookup, TraitId, TypeAliasId, TypeParamId, VariantId,
12}; 12};
13use hir_expand::name::{self, Name}; 13use hir_expand::name::{Name, N};
14 14
15// FIXME: this is wrong, b/c it can't express `trait T: PartialEq<()>`.
16// We should return a `TraitREf` here.
17fn direct_super_traits(db: &impl DefDatabase, trait_: TraitId) -> Vec<TraitId> { 15fn direct_super_traits(db: &impl DefDatabase, trait_: TraitId) -> Vec<TraitId> {
18 let resolver = trait_.resolver(db); 16 let resolver = trait_.resolver(db);
19 // returning the iterator directly doesn't easily work because of 17 // returning the iterator directly doesn't easily work because of
@@ -24,7 +22,7 @@ fn direct_super_traits(db: &impl DefDatabase, trait_: TraitId) -> Vec<TraitId> {
24 .where_predicates 22 .where_predicates
25 .iter() 23 .iter()
26 .filter_map(|pred| match &pred.type_ref { 24 .filter_map(|pred| match &pred.type_ref {
27 TypeRef::Path(p) if p.as_ident() == Some(&name::SELF_TYPE) => pred.bound.as_path(), 25 TypeRef::Path(p) if p.as_ident() == Some(&N![Self]) => pred.bound.as_path(),
28 _ => None, 26 _ => None,
29 }) 27 })
30 .filter_map(|path| match resolver.resolve_path_in_type_ns_fully(db, path) { 28 .filter_map(|path| match resolver.resolve_path_in_type_ns_fully(db, path) {