From b443e5304ec43ae2049c72b694ff62baf4314cbb Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Mon, 5 Apr 2021 21:29:20 +0200 Subject: Remove some unused methods, move some to types.rs --- crates/hir_ty/src/lib.rs | 29 ----------------------------- 1 file changed, 29 deletions(-) (limited to 'crates/hir_ty/src/lib.rs') diff --git a/crates/hir_ty/src/lib.rs b/crates/hir_ty/src/lib.rs index 61f5adbc4..2c70c4277 100644 --- a/crates/hir_ty/src/lib.rs +++ b/crates/hir_ty/src/lib.rs @@ -99,15 +99,6 @@ where Binders::empty(&Interner, value.shifted_in_from(DebruijnIndex::ONE)) } -impl Binders { - /// Substitutes all variables. - pub fn substitute(self, interner: &Interner, subst: &Substitution) -> T { - let (value, binders) = self.into_value_and_skipped_binders(); - assert_eq!(subst.len(interner), binders.len(interner)); - value.subst_bound_vars(subst) - } -} - pub fn make_only_type_binders(num_vars: usize, value: T) -> Binders { Binders::new( VariableKinds::from_iter( @@ -120,31 +111,11 @@ pub fn make_only_type_binders(num_vars: usize, value: T) -> Binders { } impl TraitRef { - pub fn self_type_parameter(&self, interner: &Interner) -> &Ty { - &self.substitution.at(interner, 0).assert_ty_ref(interner) - } - pub fn hir_trait_id(&self) -> TraitId { from_chalk_trait_id(self.trait_id) } } -impl WhereClause { - pub fn is_implemented(&self) -> bool { - matches!(self, WhereClause::Implemented(_)) - } - - pub fn trait_ref(&self, db: &dyn HirDatabase) -> Option { - match self { - WhereClause::Implemented(tr) => Some(tr.clone()), - WhereClause::AliasEq(AliasEq { alias: AliasTy::Projection(proj), .. }) => { - Some(proj.trait_ref(db)) - } - WhereClause::AliasEq(_) => None, - } - } -} - impl Canonical { pub fn new(value: T, kinds: impl IntoIterator) -> Self { let kinds = kinds.into_iter().map(|tk| { -- cgit v1.2.3