ruff
f3714fd3 - Fix leading comment formatting for lambdas with multiple parameters (#21879)

Commit
4 days ago
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)
Author
Parents
Loading