Brent Westbrook
f3714fd3c1
Fix leading comment formatting for lambdas with multiple parameters ( #21879 )
...
## Summary
This is a follow-up to #21868 . As soon as I started merging #21868 into
#21385 , I realized that I had missed a test case with `**kwargs` after
the `*args` parameter. Such a case is supposed to be formatted on one
line like:
```py
# input
(
lambda
# comment
*x,
**y: x
)
# output
(
lambda
# comment
*x, **y: x
)
```
which you can still see on the
[playground](https://play.ruff.rs/bd88d339-1358-40d2-819f-865bfcb23aef?secondary=Format ),
but on `main` after #21868 , this was formatted as:
```py
(
lambda
# comment
*x,
**y: x
)
```
because the leading comment on the first parameter caused the whole
group around the parameters to break.
Instead of making these comments leading comments on the first
parameter, this PR makes them leading comments on the parameters list as
a whole.
## Test Plan
New tests, and I will also try merging this into #21385 _before_ opening
it for review this time.
<hr>
(labeling `internal` since #21868 should not be released before some
kind of fix)
2025-12-09 18:15:12 -05:00
..
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2025-10-14 10:14:59 -04:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2025-01-09 10:20:06 +01:00
2025-01-09 10:20:06 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2025-01-09 10:20:06 +01:00
2025-01-09 10:20:06 +01:00
2024-11-15 19:31:15 +01:00
2025-01-09 10:20:06 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2025-11-18 12:02:09 -06:00
2024-11-15 19:31:15 +01:00
2025-10-14 10:14:59 -04:00
2025-10-17 08:49:16 -04:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2025-01-09 10:20:06 +01:00
2024-11-15 19:31:15 +01:00
2025-10-14 10:14:59 -04:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2025-10-14 10:14:59 -04:00
2025-01-09 10:20:06 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2025-05-22 07:52:21 +02:00
2024-11-15 19:31:15 +01:00
2025-10-14 10:14:59 -04:00
2025-01-09 10:20:06 +01:00
2025-10-14 10:14:59 -04:00
2025-10-14 10:14:59 -04:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2025-10-14 10:14:59 -04:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2025-10-14 10:14:59 -04:00
2025-10-14 10:14:59 -04:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2025-10-14 10:14:59 -04:00
2024-11-15 19:31:15 +01:00
2025-10-14 10:14:59 -04:00
2025-10-14 10:14:59 -04:00
2025-10-14 10:14:59 -04:00
2024-11-15 19:31:15 +01:00
2025-10-14 10:14:59 -04:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2025-10-14 10:14:59 -04:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2025-01-09 10:20:06 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2025-01-09 10:20:06 +01:00
2024-11-15 19:31:15 +01:00
2025-10-14 10:14:59 -04:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2025-01-09 10:20:06 +01:00
2025-10-07 12:23:11 -04:00
2024-11-15 19:31:15 +01:00
2025-04-11 10:21:47 +02:00
2025-10-07 12:23:11 -04:00
2025-10-07 12:23:11 -04:00
2025-10-07 12:23:11 -04:00
2024-11-15 19:31:15 +01:00
2024-12-09 09:32:12 +00:00
2025-10-07 12:23:11 -04:00
2025-10-07 12:23:11 -04:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2025-11-17 09:11:36 -06:00
2024-11-15 19:31:15 +01:00
2025-01-09 10:20:06 +01:00
2024-11-15 19:31:15 +01:00
2025-05-30 15:00:56 -05:00
2024-11-15 19:31:15 +01:00
2025-10-07 12:23:11 -04:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2025-10-07 12:23:11 -04:00
2025-10-17 08:49:16 -04:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2025-07-27 12:41:03 +00:00
2025-10-07 12:23:11 -04:00
2025-07-27 12:41:03 +00:00
2025-12-09 18:15:12 -05:00
2025-01-09 10:20:06 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2025-10-07 12:23:11 -04:00
2024-11-15 19:31:15 +01:00
2025-07-27 12:41:03 +00:00
2024-11-15 19:31:15 +01:00
2025-11-18 10:48:14 -05:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2025-01-09 10:20:06 +01:00
2025-06-15 06:53:06 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2025-10-07 12:23:11 -04:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2025-10-27 10:34:29 +00:00
2024-11-15 19:31:15 +01:00
2025-10-07 12:23:11 -04:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2025-11-18 12:02:09 -06:00
2024-11-15 19:31:15 +01:00
2025-11-18 12:02:09 -06:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2025-11-17 07:30:34 -06:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2025-10-31 14:53:40 -04:00
2024-11-15 19:31:15 +01:00
2025-10-07 12:23:11 -04:00
2024-11-15 19:31:15 +01:00
2025-11-18 10:48:14 -05:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2025-05-22 07:52:21 +02:00
2025-05-22 07:52:21 +02:00
2025-10-07 12:23:11 -04:00
2025-10-07 12:23:11 -04:00
2024-11-15 19:31:15 +01:00
2025-10-27 09:52:17 -05:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2025-10-07 12:23:11 -04:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2025-10-31 14:53:40 -04:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-12-09 09:32:12 +00:00
2025-10-07 12:23:11 -04:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2025-10-07 12:23:11 -04:00
2024-11-15 19:31:15 +01:00
2025-01-09 10:20:06 +01:00
2024-11-15 19:31:15 +01:00
2025-01-09 10:20:06 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2025-11-17 07:30:34 -06:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2025-11-03 17:06:52 -05:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2025-01-09 10:20:06 +01:00
2025-01-09 10:20:06 +01:00
2025-01-09 10:20:06 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2025-10-14 11:17:45 -04:00
2024-11-15 19:31:15 +01:00
2025-11-17 07:30:34 -06:00
2025-02-18 12:03:13 -05:00
2025-10-13 14:13:27 -04:00
2025-10-07 12:23:11 -04:00
2025-10-07 12:23:11 -04:00
2024-11-15 19:31:15 +01:00
2025-06-24 16:25:44 +02:00
2024-11-15 19:31:15 +01:00
2024-11-15 19:31:15 +01:00
2025-06-24 16:25:44 +02:00
2025-10-07 12:23:11 -04:00
2025-06-07 16:02:43 +02:00
2024-11-15 19:31:15 +01:00