From 24eca25d8aa06e1cf301f196789cff884cb32b33 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lauren=C8=9Biu=20Nicola?= Date: Wed, 20 Oct 2021 20:20:17 +0300 Subject: [PATCH] Make some functions non-generic --- crates/hir_def/src/item_tree/lower.rs | 8 ++++---- crates/hir_ty/src/infer/expr.rs | 2 +- crates/hir_ty/src/infer/unify.rs | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/crates/hir_def/src/item_tree/lower.rs b/crates/hir_def/src/item_tree/lower.rs index 9c278f5ac6b..2926f32b630 100644 --- a/crates/hir_def/src/item_tree/lower.rs +++ b/crates/hir_def/src/item_tree/lower.rs @@ -645,7 +645,7 @@ fn lower_extern_block(&mut self, block: &ast::ExternBlock) -> FileItemTreeId, - node: &impl ast::HasGenericParams, + node: &dyn ast::HasGenericParams, ) -> Interned { // Generics are part of item headers and may contain inner items we need to collect. if let Some(params) = node.generic_param_list() { @@ -661,7 +661,7 @@ fn lower_generic_params_and_inner_items( fn lower_generic_params( &mut self, owner: GenericsOwner<'_>, - node: &impl ast::HasGenericParams, + node: &dyn ast::HasGenericParams, ) -> Interned { let mut generics = GenericParams::default(); match owner { @@ -697,7 +697,7 @@ fn lower_generic_params( Interned::new(generics) } - fn lower_type_bounds(&mut self, node: &impl ast::HasTypeBounds) -> Vec> { + fn lower_type_bounds(&mut self, node: &dyn ast::HasTypeBounds) -> Vec> { match node.type_bound_list() { Some(bound_list) => bound_list .bounds() @@ -707,7 +707,7 @@ fn lower_type_bounds(&mut self, node: &impl ast::HasTypeBounds) -> Vec RawVisibilityId { + fn lower_visibility(&mut self, item: &dyn ast::HasVisibility) -> RawVisibilityId { let vis = match self.forced_visibility { Some(vis) => return vis, None => RawVisibility::from_ast_with_hygiene(self.db, item.visibility(), &self.hygiene), diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs index ada5717f1a5..3aad9d4cc8a 100644 --- a/crates/hir_ty/src/infer/expr.rs +++ b/crates/hir_ty/src/infer/expr.rs @@ -1037,7 +1037,7 @@ fn expected_inputs_for_expected_output( if let Some(expected_ty) = expected_output.to_option(&mut self.table) { self.table.fudge_inference(|table| { if table.try_unify(&expected_ty, &output).is_ok() { - table.resolve_with_fallback(inputs, |var, kind, _, _| match kind { + table.resolve_with_fallback(inputs, &|var, kind, _, _| match kind { chalk_ir::VariableKind::Ty(tk) => var.to_ty(&Interner, tk).cast(&Interner), chalk_ir::VariableKind::Lifetime => { var.to_lifetime(&Interner).cast(&Interner) diff --git a/crates/hir_ty/src/infer/unify.rs b/crates/hir_ty/src/infer/unify.rs index c40ef7f5875..852e545bd0e 100644 --- a/crates/hir_ty/src/infer/unify.rs +++ b/crates/hir_ty/src/infer/unify.rs @@ -128,7 +128,7 @@ pub(crate) fn unify( Some(Substitution::from_iter( &Interner, vars.iter(&Interner) - .map(|v| table.resolve_with_fallback(v.assert_ty_ref(&Interner).clone(), fallback)), + .map(|v| table.resolve_with_fallback(v.assert_ty_ref(&Interner).clone(), &fallback)), )) } @@ -291,7 +291,7 @@ pub(crate) fn new_lifetime_var(&mut self) -> Lifetime { pub(crate) fn resolve_with_fallback( &mut self, t: T, - fallback: impl Fn(InferenceVar, VariableKind, GenericArg, DebruijnIndex) -> GenericArg, + fallback: &dyn Fn(InferenceVar, VariableKind, GenericArg, DebruijnIndex) -> GenericArg, ) -> T::Result where T: HasInterner + Fold, @@ -303,7 +303,7 @@ fn resolve_with_fallback_inner( &mut self, var_stack: &mut Vec, t: T, - fallback: &impl Fn(InferenceVar, VariableKind, GenericArg, DebruijnIndex) -> GenericArg, + fallback: &dyn Fn(InferenceVar, VariableKind, GenericArg, DebruijnIndex) -> GenericArg, ) -> T::Result where T: HasInterner + Fold, @@ -319,7 +319,7 @@ pub(crate) fn resolve_completely(&mut self, t: T) -> T::Result where T: HasInterner + Fold, { - self.resolve_with_fallback(t, |_, _, d, _| d) + self.resolve_with_fallback(t, &|_, _, d, _| d) } /// Unify two types and register new trait goals that arise from that. -- 2.44.0