diff --git a/rstest_macros/src/parse/fixture.rs b/rstest_macros/src/parse/fixture.rs index 2dad5bd..ad810d8 100644 --- a/rstest_macros/src/parse/fixture.rs +++ b/rstest_macros/src/parse/fixture.rs @@ -8,8 +8,7 @@ use syn::{ use super::{ arguments::ArgumentsInfo, - extract_argument_attrs, extract_default_return_type, extract_defaults, extract_fixtures, - extract_partials_return_type, + extract_default_return_type, extract_defaults, extract_fixtures, extract_partials_return_type, future::{extract_futures, extract_global_awt}, parse_vector_trailing_till_double_comma, Attributes, ExtendWithFunctionAttrs, Fixture, }; @@ -166,36 +165,6 @@ impl VisitMut for FixturesFunctionExtractor { } } -/// Simple struct used to visit function attributes and extract fixture default values info and -/// eventualy parsing errors -#[derive(Default)] -pub(crate) struct DefaultsFunctionExtractor( - pub(crate) Vec, - pub(crate) Vec, -); - -impl VisitMut for DefaultsFunctionExtractor { - fn visit_fn_arg_mut(&mut self, node: &mut FnArg) { - let pat = match node.maybe_pat() { - Some(pat) => pat.clone(), - None => return, - }; - for r in extract_argument_attrs( - node, - |a| attr_is(a, "default"), - |a| { - a.parse_args::() - .map(|e| ArgumentValue::new(pat.clone(), e)) - }, - ) { - match r { - Ok(value) => self.0.push(value), - Err(err) => self.1.push(err), - } - } - } -} - #[derive(PartialEq, Debug, Default)] pub(crate) struct FixtureData { pub items: Vec, diff --git a/rstest_macros/src/parse/mod.rs b/rstest_macros/src/parse/mod.rs index 3115edf..baef9e6 100644 --- a/rstest_macros/src/parse/mod.rs +++ b/rstest_macros/src/parse/mod.rs @@ -340,27 +340,6 @@ impl VisitMut for PartialsTypeFunctionExtractor { }; } } -/// Simple struct used to visit function attributes and extract case arguments and -/// eventualy parsing errors -#[derive(Default)] -struct CaseArgsFunctionExtractor(Vec, Vec); - -impl VisitMut for CaseArgsFunctionExtractor { - fn visit_fn_arg_mut(&mut self, node: &mut FnArg) { - let pat = match node.maybe_pat() { - Some(pat) => pat.clone(), - None => return, - }; - for r in extract_argument_attrs(node, |a| attr_is(a, "case"), |_| Ok(())) { - match r { - Ok(_) => self.0.push(pat.clone()), - Err(err) => self.1.push(err), - } - } - - syn::visit_mut::visit_fn_arg_mut(self, node); - } -} pub(crate) fn extract_case_args(item_fn: &mut ItemFn) -> Result, ErrorsVec> { let mut extractor = JustOnceFnArgAttributeExtractor::from("case");