ruff
Keep lambda parameters on one line and parenthesize the body if it expands
#21385
Open

Keep lambda parameters on one line and parenthesize the body if it expands #21385

ntBre wants to merge 79 commits into main from brent/indent-lambda-params
ntBre
ntBre ntBre added formatter
ntBre ntBre added preview
astral-sh-bot
ntBre
ntBre commented on 2025-11-11
ntBre ntBre force pushed from 6e9b2bd5 to 958f0499 28 days ago
ntBre ntBre force pushed from 93fffd1b to b65c4077 28 days ago
ntBre ntBre force pushed from b65c4077 to 68e09d51 28 days ago
ntBre ntBre force pushed from 68e09d51 to 19326a7b 28 days ago
MichaReiser
ntBre
MichaReiser
ntBre
ntBre
ntBre commented on 2025-11-12
ntBre
ntBre ntBre changed the title [WIP] Indent lambda parameters if parameters wrap [WIP] Keep lambda parameters on one line and parenthesize the body if it expands 27 days ago
ntBre ntBre changed the title [WIP] Keep lambda parameters on one line and parenthesize the body if it expands Keep lambda parameters on one line and parenthesize the body if it expands 26 days ago
ntBre
ntBre ntBre marked this pull request as ready for review 26 days ago
ntBre ntBre requested a review from MichaReiser MichaReiser 26 days ago
MichaReiser MichaReiser requested a review from amyreese amyreese 26 days ago
MichaReiser
MichaReiser commented on 2025-11-14
MichaReiser
MichaReiser commented on 2025-11-14
MichaReiser
MichaReiser
ntBre ntBre marked this pull request as draft 21 days ago
ntBre ntBre force pushed from 32d7d52d to c405b416 21 days ago
ntBre ntBre force pushed from c405b416 to 1bfcf511 20 days ago
codspeed-hq
ntBre ntBre force pushed from 7dac1279 to b441ac64 19 days ago
ntBre ntBre changed the title Keep lambda parameters on one line and parenthesize the body if it expands Parenthesize long lambda bodies 19 days ago
ntBre ntBre force pushed from b441ac64 to c2db35b1 19 days ago
ntBre ntBre changed the title Parenthesize long lambda bodies Keep lambda parameters on one line and parenthesize the body if it expands 19 days ago
ntBre ntBre force pushed from c2db35b1 to 56c533c9 19 days ago
ntBre
MichaReiser
MichaReiser commented on 2025-11-21
ntBre
ntBre commented on 2025-11-21
ntBre ntBre force pushed from f04a18d8 to 6e7a2dce 9 days ago
ntBre
ntBre ntBre force pushed from ad77cfae to 20982524 8 days ago
amyreese
MichaReiser
MichaReiser commented on 2025-12-02
MichaReiser
MichaReiser commented on 2025-12-02
MichaReiser
MichaReiser commented on 2025-12-02
ntBre baseline test cases
1e70c991
ntBre keep lambda parameters on a single line
8cc88442
ntBre wip: parenthesize long lambda bodies
1b586430
ntBre add a poorly formatted case from the ecosystem report
74093bdb
ntBre add an unstable test case from ecosystem report
a5e13cf1
ntBre rough draft of ExprLambdaLayout::Assignment
62c968c8
ntBre add another bad case from the ecosystem check
d68a03a5
ntBre fix binary expression in lambda in return
07bcf41a
ntBre add another bad test case from the ecosystem report
6b476640
ntBre propagate lambda layout for annotated assignments
f634bb52
ntBre another bad test for long bodies with their own parens
ad314770
ntBre possibly bad test for triple-quoted f-strings
9db5d43e
ntBre exclude call and subscript expressions from has_own_parentheses
24e15bfd
ntBre avoid lambda special-casing in maybe_parenthesize_expression
0a41abed
ntBre ntBre force pushed from 40cbce56 to 7974b1c8 7 days ago
ntBre add some assignment tests with parentheses and comments
e9f9507d
ntBre add a couple more test cases
89dc1ada
ntBre ntBre force pushed from 7974b1c8 to 89dc1ada 7 days ago
ntBre
MichaReiser
MichaReiser
MichaReiser commented on 2025-12-02
MichaReiser
MichaReiser commented on 2025-12-02
MichaReiser
MichaReiser commented on 2025-12-02
ntBre use write!
18a3d593
ntBre create id only in indented case, update group name
972129c0
ntBre avoid nesting groups
2e950020
ntBre add too-eagerly parenthesized case from ecosystem
97850661
ntBre
ntBre
MichaReiser
MichaReiser commented on 2025-12-03
MichaReiser
MichaReiser
MichaReiser commented on 2025-12-03
MichaReiser
ntBre apply Micha's patch, fixing everything?
efa372b3
ntBre fix snapshot changes for cases with comments
6f6c09c7
ntBre
ntBre fix another ecosystem call expansion
9ef9d030
ntBre use parenthesize_if_expands for fluent call chains
a3400a01
ntBre add wrapping case from the ecosystem check
258b1fd7
ntBre expand parent if the lambda body breaks
04963a6b
ntBre remove comment
7dddcc85
ntBre
ntBre ntBre marked this pull request as ready for review 6 days ago
MichaReiser
MichaReiser requested changes on 2025-12-03
ntBre ntBre marked this pull request as draft 6 days ago
ntBre combine preview checks
afb01ce8
ntBre add comments and some supporting tests
2e84402f
ntBre copy mapper test case from can_omit_optional_parentheses
3a20c6f1
ntBre gate optional_parentheses branches behind stable
bdd5ba5e
ntBre Merge branch 'main' into brent/indent-lambda-params
1a3e385a
ntBre mirror comment handling from `maybe_parenthesize_expression`
08b1da3a
ntBre add some more tests
dfd3460c
MichaReiser
MichaReiser commented on 2025-12-05
ntBre check comment case first
219bbd1c
ntBre add another dangling eol case
a4b4a82e
ntBre improve dangling header comment placement
43b53edc
ntBre clippy
dc240a15
ntBre add another dangling case between lambda and parameters
5605387a
MichaReiser
MichaReiser commented on 2025-12-05
ntBre more tests
25d70b40
ntBre block indent and trailing comments
c7666423
ntBre leading_comments in block
fe255d1a
ntBre add more cases without parameters
8cbe03b3
ntBre try parenthesizing the body without parameters
c62390d1
ntBre Revert "try parenthesizing the body without parameters"
4585a0b3
ntBre factor out preview variable
3c481ba0
ntBre factor out parameters_have_comments
4d76cd7b
ntBre pairing
80852c17
ntBre wip
86406c0b
ntBre revert the last two commits, back to a stable formatting
1531c94b
ntBre fix assignment instability with dangling comments
0710e0bc
ntBre Reapply "try parenthesizing the body without parameters"
df42aa29
ntBre fix assignment instability without parameters too
f20f3e0d
ntBre move comments within lambda parameters to dangling lambda comments
8ede14a0
ntBre format new dangling comments
e8540d9b
ntBre
ntBre ntBre marked this pull request as ready for review 1 day ago
MichaReiser
MichaReiser commented on 2025-12-09
ntBre apply patch
c7b10896
ntBre clippy
ea30464a
ntBre accept snapshots
21b442a4
ntBre pass preview to handle_lambda_comment
711dd6ee
ntBre Merge branch 'main' into brent/indent-lambda-params
4ffbd496
ntBre add broken test cases
90f43bde
ntBre avoid breaking when the first parameter has leading comments
b0a82983
ntBre Merge branch 'brent/fix-kwargs' into brent/indent-lambda-params
65c94356
ntBre update snaps
fd34cd60
ntBre revert preview and comment placement changes
b8238661
ntBre revert FormatParameters changes
2bd64095
ntBre make comments leading on parameter_s_
d7221557
ntBre simplify check with parameters.start() == parameter.start()
f639389e
ntBre simplify a bit further
9d683da9
ntBre update comments
2da4798d
ntBre remove redundant parameters check
acc49ac1
ntBre update lambda comment
2e0ee2e0
ntBre Merge branch 'brent/fix-kwargs' into brent/indent-lambda-params
829f1052
ntBre clean up deref
54c76898
ntBre Merge branch 'main' into brent/indent-lambda-params
05ff8f5c
ntBre
ntBre commented on 2025-12-09
ntBre ntBre marked this pull request as draft 15 hours ago
MichaReiser
MichaReiser commented on 2025-12-10
ntBre fix lambda formatting in assignments
bb053f83
ntBre factor out maybe_parenthesize_lambda
6e9e42d3
ntBre re-apply 'pass preview to handle_lambda_comment'
33fcca9c
ntBre move preview comment handling mostly into placement.rs
9f9b76b0

Login to write a write a comment.

Login via GitHub

Reviewers
Assignees
No one assigned
Labels
Milestone