diff options
Diffstat (limited to 'macros/src/mock.rs')
-rw-r--r-- | macros/src/mock.rs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/macros/src/mock.rs b/macros/src/mock.rs index 88d3434..1b6dd67 100644 --- a/macros/src/mock.rs +++ b/macros/src/mock.rs @@ -16,7 +16,6 @@ use syn::{ ReturnType, Signature, Token, - TraitItemMethod, Type, TypePath, TypeReference, @@ -43,18 +42,15 @@ use crate::util::create_unit_type_tuple; pub struct Mock { ident: Ident, - mocked_trait: TypePath, + mocked_trait: Path, expectations_fields: Vec<ExpectationsField>, - item_methods: Vec<TraitItemMethod>, + item_methods: Vec<ImplItemMethod>, } impl Mock { - pub fn new( - ident: Ident, - mocked_trait: TypePath, - item_methods: &[TraitItemMethod], - ) -> Self + pub fn new(ident: Ident, mocked_trait: Path, item_methods: &[ImplItemMethod]) + -> Self { let expectations_fields = item_methods .iter() @@ -179,7 +175,7 @@ impl ToTokens for ExpectationsField } } -fn create_mock_function(item_method: TraitItemMethod) -> ImplItemMethod +fn create_mock_function(item_method: ImplItemMethod) -> ImplItemMethod { let func_ident = &item_method.sig.ident; @@ -247,7 +243,7 @@ fn create_mock_function(item_method: TraitItemMethod) -> ImplItemMethod } } -fn create_expect_function(mock: &Ident, item_method: &TraitItemMethod) -> ImplItemMethod +fn create_expect_function(mock: &Ident, item_method: &ImplItemMethod) -> ImplItemMethod { let signature = Signature::new( format_ident!("expect_{}", item_method.sig.ident), |