From 145faa4fd0a30d9660096fb138a17025adbe77a8 Mon Sep 17 00:00:00 2001 From: la10736 Date: Mon, 1 Jul 2024 09:38:12 +0200 Subject: [PATCH] Fix tests on nightly (removed dead code) --- checkoutlist.md | 5 +---- rstest_macros/src/parse/fixture.rs | 29 +---------------------------- rstest_macros/src/parse/mod.rs | 17 ----------------- 3 files changed, 2 insertions(+), 49 deletions(-) diff --git a/checkoutlist.md b/checkoutlist.md index c6fe373..19c559f 100644 --- a/checkoutlist.md +++ b/checkoutlist.md @@ -7,10 +7,7 @@ - [ ] `Cargo.toml` `rstest` - [ ] `Cargo.toml` `rstest_macros` - [ ] `README.md` -- [ ] Run all test - - [ ] Stable: `RSTEST_TEST_CHANNEL=stable cargo +${RSTEST_TEST_CHANNEL} test` - - [ ] Beta: `RSTEST_TEST_CHANNEL=beta cargo +${RSTEST_TEST_CHANNEL} test` - - [ ] Nightly: `RSTEST_TEST_CHANNEL=nightly cargo +${RSTEST_TEST_CHANNEL} test` +- [ ] Run all test: `for channel in stable beta nightly; do RSTEST_TEST_CHANNEL=${channel} cargo +${channel} test; done` - [ ] Create docs and checks links - [ ] Check CHANGELOG: **RELEASE DATE** and remove empty blocks - [ ] Check README diff --git a/rstest_macros/src/parse/fixture.rs b/rstest_macros/src/parse/fixture.rs index b79183a..a463f23 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, }; @@ -153,32 +152,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) { - for r in extract_argument_attrs( - node, - |a| attr_is(a, "default"), - |a, name| { - a.parse_args::() - .map(|e| ArgumentValue::new(name.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 53555b6..14e6d1d 100644 --- a/rstest_macros/src/parse/mod.rs +++ b/rstest_macros/src/parse/mod.rs @@ -340,23 +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) { - for r in extract_argument_attrs(node, |a| attr_is(a, "case"), |_a, name| Ok(name.clone())) { - match r { - Ok(value) => self.0.push(value), - 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");