Skip to content

Commit

Permalink
Made violation logic take ExprCall instead of Expr
Browse files Browse the repository at this point in the history
  • Loading branch information
trag1c committed Jan 11, 2024
1 parent 897d88f commit ea5a54a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion crates/ruff_linter/src/checkers/ast/analyze/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ pub(crate) fn expression(expr: &Expr, checker: &mut Checker) {
flake8_simplify::rules::dict_get_with_none_default(checker, expr);
}
if checker.enabled(Rule::ZipDictKeysAndValues) {
flake8_simplify::rules::zip_dict_keys_and_values(checker, expr);
flake8_simplify::rules::zip_dict_keys_and_values(checker, call);
}
if checker.any_enabled(&[
Rule::OsPathAbspath,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use ast::{ExprAttribute, ExprName, Identifier};
use ruff_macros::{derive_message_formats, violation};
use ruff_python_ast::{self as ast, Arguments, Expr};
use ruff_python_ast::{self as ast, Arguments, Expr, ExprCall};
use ruff_text_size::Ranged;

use crate::{checkers::ast::Checker, fix::snippet::SourceCodeSnippet};
Expand Down Expand Up @@ -59,15 +59,12 @@ impl AlwaysFixableViolation for ZipDictKeysAndValues {
}

/// SIM911
pub(crate) fn zip_dict_keys_and_values(checker: &mut Checker, expr: &Expr) {
let Expr::Call(ast::ExprCall {
pub(crate) fn zip_dict_keys_and_values(checker: &mut Checker, expr: &ExprCall) {
let ExprCall {
func,
arguments: Arguments { args, keywords, .. },
..
}) = expr
else {
return;
};
} = expr;
match &keywords[..] {
[] => {}
[ast::Keyword {
Expand Down

0 comments on commit ea5a54a

Please sign in to comment.