aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/utils.rs
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2021-04-08 13:35:15 +0100
committerFlorian Diebold <[email protected]>2021-04-08 13:36:14 +0100
commitd992736e796501b2a5ae232644924a3dfefede92 (patch)
tree5af343156b092f0e2a3cd0c26390428d1f1a3983 /crates/hir_ty/src/utils.rs
parent8040f4a5e3792f95b3194e21b3f6d375fb7499c5 (diff)
Remove unused
Diffstat (limited to 'crates/hir_ty/src/utils.rs')
-rw-r--r--crates/hir_ty/src/utils.rs14
1 files changed, 1 insertions, 13 deletions
diff --git a/crates/hir_ty/src/utils.rs b/crates/hir_ty/src/utils.rs
index d26f5152c..5f6cb052a 100644
--- a/crates/hir_ty/src/utils.rs
+++ b/crates/hir_ty/src/utils.rs
@@ -1,6 +1,5 @@
1//! Helper functions for working with def, which don't need to be a separate 1//! Helper functions for working with def, which don't need to be a separate
2//! query, but can't be computed directly from `*Data` (ie, which need a `db`). 2//! query, but can't be computed directly from `*Data` (ie, which need a `db`).
3use std::sync::Arc;
4 3
5use chalk_ir::{fold::Shift, BoundVar, DebruijnIndex}; 4use chalk_ir::{fold::Shift, BoundVar, DebruijnIndex};
6use hir_def::{ 5use hir_def::{
@@ -16,9 +15,7 @@ use hir_def::{
16}; 15};
17use hir_expand::name::{name, Name}; 16use hir_expand::name::{name, Name};
18 17
19use crate::{ 18use crate::{db::HirDatabase, Interner, Substitution, TraitRef, TraitRefExt, TyKind, WhereClause};
20 db::HirDatabase, Interner, Substitution, TraitRef, TraitRefExt, TyKind, TypeWalk, WhereClause,
21};
22 19
23fn direct_super_traits(db: &dyn DefDatabase, trait_: TraitId) -> Vec<TraitId> { 20fn direct_super_traits(db: &dyn DefDatabase, trait_: TraitId) -> Vec<TraitId> {
24 let resolver = trait_.resolver(db); 21 let resolver = trait_.resolver(db);
@@ -137,15 +134,6 @@ pub(super) fn associated_type_by_name_including_super_traits(
137 }) 134 })
138} 135}
139 136
140/// Helper for mutating `Arc<[T]>` (i.e. `Arc::make_mut` for Arc slices).
141/// The underlying values are cloned if there are other strong references.
142pub(crate) fn make_mut_slice<T: Clone>(a: &mut Arc<[T]>) -> &mut [T] {
143 if Arc::get_mut(a).is_none() {
144 *a = a.iter().cloned().collect();
145 }
146 Arc::get_mut(a).unwrap()
147}
148
149pub(crate) fn generics(db: &dyn DefDatabase, def: GenericDefId) -> Generics { 137pub(crate) fn generics(db: &dyn DefDatabase, def: GenericDefId) -> Generics {
150 let parent_generics = parent_generic_def(db, def).map(|def| Box::new(generics(db, def))); 138 let parent_generics = parent_generic_def(db, def).map(|def| Box::new(generics(db, def)));
151 Generics { def, params: db.generic_params(def), parent_generics } 139 Generics { def, params: db.generic_params(def), parent_generics }