mirror of https://github.com/astral-sh/ruff
clean up
This commit is contained in:
parent
4f98c5e1db
commit
80bf8b4b08
|
|
@ -148,13 +148,13 @@ pub fn check_ambiguous_variable_name(target: &Expr) -> Vec<Check> {
|
||||||
match &target.node {
|
match &target.node {
|
||||||
ExprKind::Tuple { elts, .. } | ExprKind::List { elts, .. } => {
|
ExprKind::Tuple { elts, .. } | ExprKind::List { elts, .. } => {
|
||||||
for elt in elts {
|
for elt in elts {
|
||||||
if let Some(check) = check_target(&elt) {
|
if let Some(check) = check_target(elt) {
|
||||||
checks.push(check);
|
checks.push(check);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
if let Some(check) = check_target(&target) {
|
if let Some(check) = check_target(target) {
|
||||||
checks.push(check);
|
checks.push(check);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -407,15 +407,15 @@ where
|
||||||
StmtKind::For { target, .. } => {
|
StmtKind::For { target, .. } => {
|
||||||
if self.settings.select.contains(&CheckCode::E741) {
|
if self.settings.select.contains(&CheckCode::E741) {
|
||||||
self.checks
|
self.checks
|
||||||
.extend(checks::check_ambiguous_variable_name(&target));
|
.extend(checks::check_ambiguous_variable_name(target));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
StmtKind::With { items, .. } | StmtKind::AsyncWith { items, .. } => {
|
StmtKind::With { items, .. } | StmtKind::AsyncWith { items, .. } => {
|
||||||
if self.settings.select.contains(&CheckCode::E741) {
|
if self.settings.select.contains(&CheckCode::E741) {
|
||||||
for item in items {
|
for item in items {
|
||||||
if let Some(optional_vars) = &item.optional_vars {
|
if let Some(vars) = &item.optional_vars {
|
||||||
self.checks
|
self.checks
|
||||||
.extend(checks::check_ambiguous_variable_name(optional_vars))
|
.extend(checks::check_ambiguous_variable_name(vars))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue