mirror of
https://github.com/astral-sh/ruff
synced 2026-01-07 22:54:28 -05:00
Fix empty lambda args range (#35)
Previously, empty lambda arguments (e.g. `lambda: 1`) would get the range of the entire expression, which leads to incorrect comment placement. Now empty lambda arguments get an empty range between the `lambda` and the `:` tokens.
This commit is contained in:
@@ -636,6 +636,13 @@ mod tests {
|
||||
insta::assert_debug_snapshot!(parse_ast);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_parse_lambda_no_args() {
|
||||
let source = "lambda: 1";
|
||||
let parse_ast = ast::Suite::parse(source, "<test>").unwrap();
|
||||
insta::assert_debug_snapshot!(parse_ast);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_parse_tuples() {
|
||||
let source = "a, b = 4, 5";
|
||||
|
||||
Reference in New Issue
Block a user