diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/rules/marks.rs b/crates/ruff_linter/src/rules/flake8_pytest_style/rules/marks.rs index d58dc7f5f7..0be4eb4d50 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/rules/marks.rs +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/rules/marks.rs @@ -167,23 +167,24 @@ fn check_useless_usefixtures(checker: &mut Checker, decorator: &Decorator, marke return; } - let mut has_parameters = false; - - if let Expr::Call(ast::ExprCall { - arguments: Arguments { args, keywords, .. }, - .. - }) = &decorator.expression - { - if !args.is_empty() || !keywords.is_empty() { - has_parameters = true; + match &decorator.expression { + // @pytest.mark.usefixtures + Expr::Attribute(..) => {} + // @pytest.mark.usefixtures(...) + Expr::Call(ast::ExprCall { + arguments: Arguments { args, keywords, .. }, + .. + }) => { + if !args.is_empty() || !keywords.is_empty() { + return; + } } + _ => return, } - if !has_parameters { - let mut diagnostic = Diagnostic::new(PytestUseFixturesWithoutParameters, decorator.range()); - diagnostic.set_fix(Fix::unsafe_edit(Edit::range_deletion(decorator.range()))); - checker.diagnostics.push(diagnostic); - } + let mut diagnostic = Diagnostic::new(PytestUseFixturesWithoutParameters, decorator.range()); + diagnostic.set_fix(Fix::unsafe_edit(Edit::range_deletion(decorator.range()))); + checker.diagnostics.push(diagnostic); } pub(crate) fn marks(checker: &mut Checker, decorators: &[Decorator]) {