Skip to content

Commit

Permalink
Fixed warning in beta
Browse files Browse the repository at this point in the history
  • Loading branch information
la10736 committed Aug 4, 2024
1 parent d35ade2 commit 3949076
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 53 deletions.
33 changes: 1 addition & 32 deletions rstest_macros/src/parse/fixture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -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<ArgumentValue>,
pub(crate) Vec<syn::Error>,
);

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::<Expr>()
.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<FixtureItem>,
Expand Down
21 changes: 0 additions & 21 deletions rstest_macros/src/parse/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Pat>, Vec<syn::Error>);

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<Vec<Pat>, ErrorsVec> {
let mut extractor = JustOnceFnArgAttributeExtractor::from("case");
Expand Down

0 comments on commit 3949076

Please sign in to comment.