mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-01 06:11:21 +00:00
Remove unnecessary mutable variable has_parameters
(#8124)
This commit is contained in:
parent
2c2ebf952a
commit
c0710a1dd4
1 changed files with 15 additions and 14 deletions
|
@ -167,24 +167,25 @@ fn check_useless_usefixtures(checker: &mut Checker, decorator: &Decorator, marke
|
|||
return;
|
||||
}
|
||||
|
||||
let mut has_parameters = false;
|
||||
|
||||
if let Expr::Call(ast::ExprCall {
|
||||
match &decorator.expression {
|
||||
// @pytest.mark.usefixtures
|
||||
Expr::Attribute(..) => {}
|
||||
// @pytest.mark.usefixtures(...)
|
||||
Expr::Call(ast::ExprCall {
|
||||
arguments: Arguments { args, keywords, .. },
|
||||
..
|
||||
}) = &decorator.expression
|
||||
{
|
||||
}) => {
|
||||
if !args.is_empty() || !keywords.is_empty() {
|
||||
has_parameters = true;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn marks(checker: &mut Checker, decorators: &[Decorator]) {
|
||||
let enforce_parentheses = checker.enabled(Rule::PytestIncorrectMarkParenthesesStyle);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue