From a93fc9fb080151f7ed66af7a923db544a41556cd Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 18 Sep 2022 12:36:49 +0200 Subject: test: move some factory function types to type aliases --- src/di_container.rs | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/di_container.rs b/src/di_container.rs index 532a905..ac75f81 100644 --- a/src/di_container.rs +++ b/src/di_container.rs @@ -972,6 +972,13 @@ mod tests } } + type FactoryFunc = dyn Fn< + (std::rc::Rc,), + Output = Box< + dyn Fn<(Vec,), Output = crate::ptr::TransientPtr>, + >, + >; + use crate as syrette; #[crate::factory] @@ -992,12 +999,7 @@ mod tests let di_container = DIContainer::new(); - let factory_func: &'static dyn Fn< - (std::rc::Rc,), - Output = Box< - dyn Fn<(Vec,), Output = crate::ptr::TransientPtr>, - >, - > = &|_: Rc| { + let factory_func: &'static FactoryFunc = &|_: Rc| { Box::new(move |users| { let user_manager: TransientPtr = TransientPtr::new(UserManager::new(users)); @@ -1066,6 +1068,13 @@ mod tests } } + type FactoryFunc = dyn Fn< + (std::rc::Rc,), + Output = Box< + dyn Fn<(Vec,), Output = crate::ptr::TransientPtr>, + >, + >; + use crate as syrette; #[crate::factory] @@ -1086,12 +1095,7 @@ mod tests let di_container = DIContainer::new(); - let factory_func: &'static dyn Fn< - (std::rc::Rc,), - Output = Box< - dyn Fn<(Vec,), Output = crate::ptr::TransientPtr>, - >, - > = &|_: Rc| { + let factory_func: &'static FactoryFunc = &|_: Rc| { Box::new(move |users| { let user_manager: TransientPtr = TransientPtr::new(UserManager::new(users)); -- cgit v1.2.3-18-g5258