diff options
Diffstat (limited to 'crates/ra_hir_ty/src/utils.rs')
-rw-r--r-- | crates/ra_hir_ty/src/utils.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/crates/ra_hir_ty/src/utils.rs b/crates/ra_hir_ty/src/utils.rs index 463fd65b4..b40d4eb73 100644 --- a/crates/ra_hir_ty/src/utils.rs +++ b/crates/ra_hir_ty/src/utils.rs | |||
@@ -14,7 +14,7 @@ use hir_def::{ | |||
14 | }; | 14 | }; |
15 | use hir_expand::name::{name, Name}; | 15 | use hir_expand::name::{name, Name}; |
16 | 16 | ||
17 | fn direct_super_traits(db: &impl DefDatabase, trait_: TraitId) -> Vec<TraitId> { | 17 | fn direct_super_traits(db: &dyn DefDatabase, trait_: TraitId) -> Vec<TraitId> { |
18 | let resolver = trait_.resolver(db); | 18 | let resolver = trait_.resolver(db); |
19 | // returning the iterator directly doesn't easily work because of | 19 | // returning the iterator directly doesn't easily work because of |
20 | // lifetime problems, but since there usually shouldn't be more than a | 20 | // lifetime problems, but since there usually shouldn't be more than a |
@@ -43,7 +43,7 @@ fn direct_super_traits(db: &impl DefDatabase, trait_: TraitId) -> Vec<TraitId> { | |||
43 | 43 | ||
44 | /// Returns an iterator over the whole super trait hierarchy (including the | 44 | /// Returns an iterator over the whole super trait hierarchy (including the |
45 | /// trait itself). | 45 | /// trait itself). |
46 | pub(super) fn all_super_traits(db: &impl DefDatabase, trait_: TraitId) -> Vec<TraitId> { | 46 | pub(super) fn all_super_traits(db: &dyn DefDatabase, trait_: TraitId) -> Vec<TraitId> { |
47 | // we need to take care a bit here to avoid infinite loops in case of cycles | 47 | // we need to take care a bit here to avoid infinite loops in case of cycles |
48 | // (i.e. if we have `trait A: B; trait B: A;`) | 48 | // (i.e. if we have `trait A: B; trait B: A;`) |
49 | let mut result = vec![trait_]; | 49 | let mut result = vec![trait_]; |
@@ -65,7 +65,7 @@ pub(super) fn all_super_traits(db: &impl DefDatabase, trait_: TraitId) -> Vec<Tr | |||
65 | /// Finds a path from a trait to one of its super traits. Returns an empty | 65 | /// Finds a path from a trait to one of its super traits. Returns an empty |
66 | /// vector if there is no path. | 66 | /// vector if there is no path. |
67 | pub(super) fn find_super_trait_path( | 67 | pub(super) fn find_super_trait_path( |
68 | db: &impl DefDatabase, | 68 | db: &dyn DefDatabase, |
69 | trait_: TraitId, | 69 | trait_: TraitId, |
70 | super_trait: TraitId, | 70 | super_trait: TraitId, |
71 | ) -> Vec<TraitId> { | 71 | ) -> Vec<TraitId> { |
@@ -73,7 +73,7 @@ pub(super) fn find_super_trait_path( | |||
73 | result.push(trait_); | 73 | result.push(trait_); |
74 | return if go(db, super_trait, &mut result) { result } else { Vec::new() }; | 74 | return if go(db, super_trait, &mut result) { result } else { Vec::new() }; |
75 | 75 | ||
76 | fn go(db: &impl DefDatabase, super_trait: TraitId, path: &mut Vec<TraitId>) -> bool { | 76 | fn go(db: &dyn DefDatabase, super_trait: TraitId, path: &mut Vec<TraitId>) -> bool { |
77 | let trait_ = *path.last().unwrap(); | 77 | let trait_ = *path.last().unwrap(); |
78 | if trait_ == super_trait { | 78 | if trait_ == super_trait { |
79 | return true; | 79 | return true; |
@@ -95,7 +95,7 @@ pub(super) fn find_super_trait_path( | |||
95 | } | 95 | } |
96 | 96 | ||
97 | pub(super) fn associated_type_by_name_including_super_traits( | 97 | pub(super) fn associated_type_by_name_including_super_traits( |
98 | db: &impl DefDatabase, | 98 | db: &dyn DefDatabase, |
99 | trait_: TraitId, | 99 | trait_: TraitId, |
100 | name: &Name, | 100 | name: &Name, |
101 | ) -> Option<TypeAliasId> { | 101 | ) -> Option<TypeAliasId> { |
@@ -104,7 +104,7 @@ pub(super) fn associated_type_by_name_including_super_traits( | |||
104 | .find_map(|t| db.trait_data(t).associated_type_by_name(name)) | 104 | .find_map(|t| db.trait_data(t).associated_type_by_name(name)) |
105 | } | 105 | } |
106 | 106 | ||
107 | pub(super) fn variant_data(db: &impl DefDatabase, var: VariantId) -> Arc<VariantData> { | 107 | pub(super) fn variant_data(db: &dyn DefDatabase, var: VariantId) -> Arc<VariantData> { |
108 | match var { | 108 | match var { |
109 | VariantId::StructId(it) => db.struct_data(it).variant_data.clone(), | 109 | VariantId::StructId(it) => db.struct_data(it).variant_data.clone(), |
110 | VariantId::UnionId(it) => db.union_data(it).variant_data.clone(), | 110 | VariantId::UnionId(it) => db.union_data(it).variant_data.clone(), |
@@ -123,7 +123,7 @@ pub(crate) fn make_mut_slice<T: Clone>(a: &mut Arc<[T]>) -> &mut [T] { | |||
123 | Arc::get_mut(a).unwrap() | 123 | Arc::get_mut(a).unwrap() |
124 | } | 124 | } |
125 | 125 | ||
126 | pub(crate) fn generics(db: &impl DefDatabase, def: GenericDefId) -> Generics { | 126 | pub(crate) fn generics(db: &dyn DefDatabase, def: GenericDefId) -> Generics { |
127 | let parent_generics = parent_generic_def(db, def).map(|def| Box::new(generics(db, def))); | 127 | let parent_generics = parent_generic_def(db, def).map(|def| Box::new(generics(db, def))); |
128 | Generics { def, params: db.generic_params(def), parent_generics } | 128 | Generics { def, params: db.generic_params(def), parent_generics } |
129 | } | 129 | } |
@@ -222,7 +222,7 @@ impl Generics { | |||
222 | } | 222 | } |
223 | } | 223 | } |
224 | 224 | ||
225 | fn parent_generic_def(db: &impl DefDatabase, def: GenericDefId) -> Option<GenericDefId> { | 225 | fn parent_generic_def(db: &dyn DefDatabase, def: GenericDefId) -> Option<GenericDefId> { |
226 | let container = match def { | 226 | let container = match def { |
227 | GenericDefId::FunctionId(it) => it.lookup(db).container, | 227 | GenericDefId::FunctionId(it) => it.lookup(db).container, |
228 | GenericDefId::TypeAliasId(it) => it.lookup(db).container, | 228 | GenericDefId::TypeAliasId(it) => it.lookup(db).container, |