From 43e0bdb4cc598f199eacb63f755f30dc2108146b Mon Sep 17 00:00:00 2001 From: HampusM Date: Sat, 18 Mar 2023 18:26:53 +0100 Subject: feat: parse impl in mock macro as actual impl block --- macros/src/lib.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'macros/src/lib.rs') 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::>(); -- cgit v1.2.3-18-g5258