diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-12-14 14:08:08 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-12-14 14:08:08 +0000 |
commit | 77db6177658b32f69ad7ebfdef96c1b3b2893fdd (patch) | |
tree | 2a9f0f16b34821dfe4319bef410e177311e87f16 /crates/ra_hir_ty/src/utils.rs | |
parent | 7238037de42a2fd88434930c521b926d7b0026da (diff) | |
parent | f02fcc16444fcd18ccd51b43fa01bf0233e044fa (diff) |
Merge #2554
2554: Add macros for known names and paths r=matklad a=flodiebold
Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/ra_hir_ty/src/utils.rs')
-rw-r--r-- | crates/ra_hir_ty/src/utils.rs | 6 |
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..0049d3c6f 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 | }; |
13 | use hir_expand::name::{self, Name}; | 13 | use hir_expand::name::{name, Name}; |
14 | 14 | ||
15 | // FIXME: this is wrong, b/c it can't express `trait T: PartialEq<()>`. | ||
16 | // We should return a `TraitREf` here. | ||
17 | fn direct_super_traits(db: &impl DefDatabase, trait_: TraitId) -> Vec<TraitId> { | 15 | fn 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(&name![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) { |