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