summaryrefslogtreecommitdiff
path: root/macros/src/lib.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2023-03-18 18:26:53 +0100
committerHampusM <hampus@hampusmat.com>2023-03-18 18:26:53 +0100
commit43e0bdb4cc598f199eacb63f755f30dc2108146b (patch)
tree66f6bfc7fff793e2b267564fc05db4494a9ca2af /macros/src/lib.rs
parentc48271aef7e6b0819c497f302127c161845a83d7 (diff)
feat: parse impl in mock macro as actual impl block
Diffstat (limited to 'macros/src/lib.rs')
-rw-r--r--macros/src/lib.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/macros/src/lib.rs b/macros/src/lib.rs
index ce91f87..36c6ad7 100644
--- a/macros/src/lib.rs
+++ b/macros/src/lib.rs
@@ -2,7 +2,7 @@
use proc_macro::TokenStream;
use proc_macro_error::{proc_macro_error, ResultExt};
use quote::{format_ident, quote};
-use syn::{parse, TraitItem};
+use syn::{parse, ImplItem};
use crate::expectation::Expectation;
use crate::mock::Mock;
@@ -25,10 +25,11 @@ pub fn mock(input_stream: TokenStream) -> TokenStream
let mock_mod_ident = format_ident!("__{mock_ident}");
let method_items = input
+ .item_impl
.items
.into_iter()
.filter_map(|item| match item {
- TraitItem::Method(item_method) => Some(item_method),
+ ImplItem::Method(item_method) => Some(item_method),
_ => None,
})
.collect::<Vec<_>>();