From 738174671ae40092684d7a9a543f939e318051e5 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Mon, 5 Apr 2021 21:25:40 +0200 Subject: Binders::wrap_empty -> wrap_empty_binders --- crates/hir_ty/src/lib.rs | 12 +++++------- crates/hir_ty/src/lower.rs | 8 +++++--- crates/hir_ty/src/traits/chalk.rs | 8 ++------ 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/crates/hir_ty/src/lib.rs b/crates/hir_ty/src/lib.rs index 6d5123cf1..61f5adbc4 100644 --- a/crates/hir_ty/src/lib.rs +++ b/crates/hir_ty/src/lib.rs @@ -92,13 +92,11 @@ pub fn param_idx(db: &dyn HirDatabase, id: TypeParamId) -> Option { generics(db.upcast(), id.parent).param_idx(id) } -impl Binders { - pub fn wrap_empty(value: T) -> Self - where - T: TypeWalk, - { - Binders::empty(&Interner, value.shifted_in_from(DebruijnIndex::ONE)) - } +pub fn wrap_empty_binders(value: T) -> Binders +where + T: TypeWalk, +{ + Binders::empty(&Interner, value.shifted_in_from(DebruijnIndex::ONE)) } impl Binders { diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs index 48c26f471..6cef8095f 100644 --- a/crates/hir_ty/src/lower.rs +++ b/crates/hir_ty/src/lower.rs @@ -384,7 +384,9 @@ impl<'a> TyLoweringContext<'a> { 1, QuantifiedWhereClauses::from_iter( &Interner, - Some(Binders::wrap_empty(WhereClause::Implemented(trait_ref))), + Some(crate::wrap_empty_binders(WhereClause::Implemented( + trait_ref, + ))), ), ), }; @@ -720,7 +722,7 @@ impl<'a> TyLoweringContext<'a> { let trait_ref = match bound { TypeBound::Path(path) => { bindings = self.lower_trait_ref_from_path(path, Some(self_ty)); - bindings.clone().map(WhereClause::Implemented).map(|b| Binders::wrap_empty(b)) + bindings.clone().map(WhereClause::Implemented).map(|b| crate::wrap_empty_binders(b)) } TypeBound::Lifetime(_) => None, TypeBound::Error => None, @@ -767,7 +769,7 @@ impl<'a> TyLoweringContext<'a> { let ty = self.lower_ty(type_ref); let alias_eq = AliasEq { alias: AliasTy::Projection(projection_ty.clone()), ty }; - preds.push(Binders::wrap_empty(WhereClause::AliasEq(alias_eq))); + preds.push(crate::wrap_empty_binders(WhereClause::AliasEq(alias_eq))); } for bound in &binding.bounds { preds.extend(self.lower_type_bound( diff --git a/crates/hir_ty/src/traits/chalk.rs b/crates/hir_ty/src/traits/chalk.rs index 075e82f4b..5a8b5cd86 100644 --- a/crates/hir_ty/src/traits/chalk.rs +++ b/crates/hir_ty/src/traits/chalk.rs @@ -246,8 +246,8 @@ impl<'a> chalk_solve::RustIrDatabase for ChalkContext<'a> { let bound = OpaqueTyDatumBound { bounds: make_binders( vec![ - wrap_in_empty_binders(impl_bound).to_chalk(self.db), - wrap_in_empty_binders(proj_bound).to_chalk(self.db), + crate::wrap_empty_binders(impl_bound).to_chalk(self.db), + crate::wrap_empty_binders(proj_bound).to_chalk(self.db), ], 1, ), @@ -723,7 +723,3 @@ impl From for chalk_ir::ClosureId { chalk_ir::ClosureId(id.as_intern_id()) } } - -fn wrap_in_empty_binders(value: T) -> crate::Binders { - crate::Binders::wrap_empty(value) -} -- cgit v1.2.3