diff options
Diffstat (limited to 'macros/src/expectation.rs')
-rw-r--r-- | macros/src/expectation.rs | 36 |
1 files changed, 2 insertions, 34 deletions
diff --git a/macros/src/expectation.rs b/macros/src/expectation.rs index 436d571..5a4922c 100644 --- a/macros/src/expectation.rs +++ b/macros/src/expectation.rs @@ -16,9 +16,6 @@ use syn::{ ImplItemMethod, ItemStruct, Lifetime, - Pat, - PatIdent, - PatType, Path, PathSegment, Receiver, @@ -268,35 +265,6 @@ impl ToTokens for Expectation self.return_type.clone(), )); - let args = opt_self_type - .iter() - .chain(self.arg_types.iter()) - .enumerate() - .map(|(index, ty)| { - FnArg::Typed(PatType { - attrs: vec![], - pat: Box::new(Pat::Ident(PatIdent { - attrs: vec![], - by_ref: None, - mutability: None, - ident: format_ident!("arg_{index}"), - subpat: None, - })), - colon_token: <Token![:]>::default(), - ty: Box::new(ty.clone()), - }) - }) - .collect::<Vec<_>>(); - - let arg_idents = opt_self_type - .iter() - .chain(self.arg_types.iter()) - .enumerate() - .map(|(index, _)| format_ident!("arg_{index}")) - .collect::<Vec<_>>(); - - let return_type = &self.return_type; - let method_ident = &self.method_ident; let expectation_struct = Self::create_struct( @@ -358,7 +326,7 @@ impl ToTokens for Expectation unsafe { std::mem::transmute(self) } } - fn call_returning(&self, #(#args),*) #return_type + fn get_returning(&self) -> &#returning_fn { let Some(returning) = &self.returning else { panic!(concat!( @@ -398,7 +366,7 @@ impl ToTokens for Expectation self.call_cnt.fetch_add(1, std::sync::atomic::Ordering::Relaxed); - (returning)(#(#arg_idents),*) + returning } } |