mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-23 04:55:09 +00:00
Misc. stylistic changes from flipping through rules late at night (#5757)
## Summary This is really bad PR hygiene, but a mix of: using `Locator`-based fixes in a few places (in lieu of `Generator`-based fixes), using match syntax to avoid `.len() == 1` checks, using common helpers in more places, etc. ## Test Plan `cargo test`
This commit is contained in:
parent
875e04e369
commit
5a4516b812
22 changed files with 127 additions and 169 deletions
|
@ -549,10 +549,7 @@ pub fn is_assignment_to_a_dunder(stmt: &Stmt) -> bool {
|
|||
// annotation. This is what pycodestyle (as of 2.9.1) does.
|
||||
match stmt {
|
||||
Stmt::Assign(ast::StmtAssign { targets, .. }) => {
|
||||
if targets.len() != 1 {
|
||||
return false;
|
||||
}
|
||||
if let Expr::Name(ast::ExprName { id, .. }) = &targets[0] {
|
||||
if let [Expr::Name(ast::ExprName { id, .. })] = targets.as_slice() {
|
||||
is_dunder(id)
|
||||
} else {
|
||||
false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue