This commit is contained in:
harupy 2022-09-10 18:37:00 +09:00
parent 4f98c5e1db
commit 80bf8b4b08
2 changed files with 5 additions and 5 deletions

View File

@ -148,13 +148,13 @@ pub fn check_ambiguous_variable_name(target: &Expr) -> Vec<Check> {
match &target.node {
ExprKind::Tuple { elts, .. } | ExprKind::List { elts, .. } => {
for elt in elts {
if let Some(check) = check_target(&elt) {
if let Some(check) = check_target(elt) {
checks.push(check);
};
}
}
_ => {
if let Some(check) = check_target(&target) {
if let Some(check) = check_target(target) {
checks.push(check);
};
}

View File

@ -407,15 +407,15 @@ where
StmtKind::For { target, .. } => {
if self.settings.select.contains(&CheckCode::E741) {
self.checks
.extend(checks::check_ambiguous_variable_name(&target));
.extend(checks::check_ambiguous_variable_name(target));
}
}
StmtKind::With { items, .. } | StmtKind::AsyncWith { items, .. } => {
if self.settings.select.contains(&CheckCode::E741) {
for item in items {
if let Some(optional_vars) = &item.optional_vars {
if let Some(vars) = &item.optional_vars {
self.checks
.extend(checks::check_ambiguous_variable_name(optional_vars))
.extend(checks::check_ambiguous_variable_name(vars))
}
}
}