aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/utils.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_ty/src/utils.rs')
-rw-r--r--crates/ra_hir_ty/src/utils.rs32
1 files changed, 0 insertions, 32 deletions
diff --git a/crates/ra_hir_ty/src/utils.rs b/crates/ra_hir_ty/src/utils.rs
index c45820ff0..e3e244268 100644
--- a/crates/ra_hir_ty/src/utils.rs
+++ b/crates/ra_hir_ty/src/utils.rs
@@ -110,38 +110,6 @@ pub(super) fn all_super_trait_refs(db: &dyn HirDatabase, trait_ref: TraitRef) ->
110 result 110 result
111} 111}
112 112
113/// Finds a path from a trait to one of its super traits. Returns an empty
114/// vector if there is no path.
115pub(super) fn find_super_trait_path(
116 db: &dyn DefDatabase,
117 trait_: TraitId,
118 super_trait: TraitId,
119) -> Vec<TraitId> {
120 let mut result = Vec::with_capacity(2);
121 result.push(trait_);
122 return if go(db, super_trait, &mut result) { result } else { Vec::new() };
123
124 fn go(db: &dyn DefDatabase, super_trait: TraitId, path: &mut Vec<TraitId>) -> bool {
125 let trait_ = *path.last().unwrap();
126 if trait_ == super_trait {
127 return true;
128 }
129
130 for tt in direct_super_traits(db, trait_) {
131 if path.contains(&tt) {
132 continue;
133 }
134 path.push(tt);
135 if go(db, super_trait, path) {
136 return true;
137 } else {
138 path.pop();
139 }
140 }
141 false
142 }
143}
144
145pub(super) fn associated_type_by_name_including_super_traits( 113pub(super) fn associated_type_by_name_including_super_traits(
146 db: &dyn HirDatabase, 114 db: &dyn HirDatabase,
147 trait_ref: TraitRef, 115 trait_ref: TraitRef,