Skip to content

Commit b443e53

Browse files
committed
Remove some unused methods, move some to types.rs
1 parent 7381746 commit b443e53

File tree

2 files changed

+15
-29
lines changed

2 files changed

+15
-29
lines changed

crates/hir_ty/src/lib.rs

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,6 @@ where
9999
Binders::empty(&Interner, value.shifted_in_from(DebruijnIndex::ONE))
100100
}
101101

102-
impl<T: TypeWalk> Binders<T> {
103-
/// Substitutes all variables.
104-
pub fn substitute(self, interner: &Interner, subst: &Substitution) -> T {
105-
let (value, binders) = self.into_value_and_skipped_binders();
106-
assert_eq!(subst.len(interner), binders.len(interner));
107-
value.subst_bound_vars(subst)
108-
}
109-
}
110-
111102
pub fn make_only_type_binders<T>(num_vars: usize, value: T) -> Binders<T> {
112103
Binders::new(
113104
VariableKinds::from_iter(
@@ -120,31 +111,11 @@ pub fn make_only_type_binders<T>(num_vars: usize, value: T) -> Binders<T> {
120111
}
121112

122113
impl TraitRef {
123-
pub fn self_type_parameter(&self, interner: &Interner) -> &Ty {
124-
&self.substitution.at(interner, 0).assert_ty_ref(interner)
125-
}
126-
127114
pub fn hir_trait_id(&self) -> TraitId {
128115
from_chalk_trait_id(self.trait_id)
129116
}
130117
}
131118

132-
impl WhereClause {
133-
pub fn is_implemented(&self) -> bool {
134-
matches!(self, WhereClause::Implemented(_))
135-
}
136-
137-
pub fn trait_ref(&self, db: &dyn HirDatabase) -> Option<TraitRef> {
138-
match self {
139-
WhereClause::Implemented(tr) => Some(tr.clone()),
140-
WhereClause::AliasEq(AliasEq { alias: AliasTy::Projection(proj), .. }) => {
141-
Some(proj.trait_ref(db))
142-
}
143-
WhereClause::AliasEq(_) => None,
144-
}
145-
}
146-
}
147-
148119
impl<T> Canonical<T> {
149120
pub fn new(value: T, kinds: impl IntoIterator<Item = TyVariableKind>) -> Self {
150121
let kinds = kinds.into_iter().map(|tk| {

crates/hir_ty/src/types.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,15 @@ impl<T: Clone> Binders<&T> {
360360
}
361361
}
362362

363+
impl<T: TypeWalk> Binders<T> {
364+
/// Substitutes all variables.
365+
pub fn substitute(self, interner: &Interner, subst: &Substitution) -> T {
366+
let (value, binders) = self.into_value_and_skipped_binders();
367+
assert_eq!(subst.len(interner), binders.len(interner));
368+
value.subst_bound_vars(subst)
369+
}
370+
}
371+
363372
impl<T: std::fmt::Debug> std::fmt::Debug for Binders<T> {
364373
fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
365374
let Binders { ref binders, ref value } = *self;
@@ -375,6 +384,12 @@ pub struct TraitRef {
375384
pub substitution: Substitution,
376385
}
377386

387+
impl TraitRef {
388+
pub fn self_type_parameter(&self, interner: &Interner) -> &Ty {
389+
&self.substitution.at(interner, 0).assert_ty_ref(interner)
390+
}
391+
}
392+
378393
/// Like `generics::WherePredicate`, but with resolved types: A condition on the
379394
/// parameters of a generic item.
380395
#[derive(Debug, Clone, PartialEq, Eq, Hash)]

0 commit comments

Comments
 (0)