Fix E231 bug: Inconsistent catch compared to pycodestyle, such as when dict nested in list#10469
Conversation
f446cd4 to
2837639
Compare
|
2837639 to
6e779de
Compare
crates/ruff_linter/src/rules/pycodestyle/rules/logical_lines/missing_whitespace.rs
Outdated
Show resolved
Hide resolved
...ter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E231_E23.py.snap
Show resolved
Hide resolved
|
Thanks for looking into this. Using a stack here makes sense. I'm surprised that this isn't hitting performance more, considering that we're now allocating a new |
Ya it's surprising. But is allocating a new |
dbdb4c5 to
37d2270
Compare
|
Took inspiration from |
That's correct: Creating an empty
Nice, thank you |
| match (kind, next_token.kind()) { | ||
| (TokenKind::Colon, _) | ||
| if open_parentheses > 0 && prev_lsqb > prev_lbrace => | ||
| if matches!(brackets.last(), Some(TokenKind::Lsqb)) => |
There was a problem hiding this comment.
I find this much easier to understand. Nice refactor
Summary
Fix
E231bug: Inconsistent catch compared to pycodestyle, such as when dict nested in list. Resolves #10113.Test Plan
Example from #10113 added to test fixture.