mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-03 18:28:24 +00:00
Ignore colon-after-lambda in compound statement rules (#2771)
This commit is contained in:
parent
77099dcd4d
commit
43b7ee215c
2 changed files with 17 additions and 0 deletions
|
@ -44,3 +44,5 @@ a: List[str] = []
|
|||
#:
|
||||
if a := 1:
|
||||
pass
|
||||
#:
|
||||
func = lambda x: x** 2 if cond else lambda x:x
|
||||
|
|
|
@ -182,6 +182,21 @@ pub fn compound_statements(lxr: &[LexResult]) -> Vec<Diagnostic> {
|
|||
}
|
||||
|
||||
match tok {
|
||||
Tok::Lambda => {
|
||||
// Reset.
|
||||
def = None;
|
||||
colon = None;
|
||||
class = None;
|
||||
elif = None;
|
||||
else_ = None;
|
||||
except = None;
|
||||
finally = None;
|
||||
for_ = None;
|
||||
if_ = None;
|
||||
try_ = None;
|
||||
while_ = None;
|
||||
with = None;
|
||||
}
|
||||
Tok::If => {
|
||||
if_ = Some((start, end));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue