Commit 054e3ca
committed
Improve lambda formatting
#19
The style guide says:
"A line is never broken adjacent to the arrow in a lambda, except that
a break may come immediately after the arrow if the body of the lambda
consists of a single unbraced expression."
There are two changes here:
1. Don't put a newline after the arrow.
2. When the only argument to a function is a lambda, don't put
a newline after the open-paren of the function. I think
this newline was going in because a lambda is a single expression
that is longer than (the remainder of) a line. But generally, it's
prettier to break inside the lambda.1 parent 02de39a commit 054e3ca
File tree
5 files changed
+25
-40
lines changed- core/src
- main/java/com/google/googlejavaformat/java
- test/resources/com/google/googlejavaformat/java/testdata
5 files changed
+25
-40
lines changedLines changed: 8 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1185 | 1185 | | |
1186 | 1186 | | |
1187 | 1187 | | |
1188 | | - | |
1189 | | - | |
1190 | | - | |
1191 | | - | |
1192 | | - | |
| 1188 | + | |
1193 | 1189 | | |
1194 | 1190 | | |
1195 | 1191 | | |
| |||
2793 | 2789 | | |
2794 | 2790 | | |
2795 | 2791 | | |
2796 | | - | |
| 2792 | + | |
| 2793 | + | |
| 2794 | + | |
| 2795 | + | |
| 2796 | + | |
| 2797 | + | |
| 2798 | + | |
2797 | 2799 | | |
2798 | 2800 | | |
2799 | 2801 | | |
| |||
Lines changed: 3 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
93 | | - | |
94 | | - | |
| 92 | + | |
95 | 93 | | |
96 | 94 | | |
97 | 95 | | |
98 | | - | |
99 | | - | |
100 | | - | |
| 96 | + | |
101 | 97 | | |
102 | | - | |
103 | | - | |
104 | | - | |
| 98 | + | |
105 | 99 | | |
106 | 100 | | |
107 | 101 | | |
Lines changed: 4 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
41 | | - | |
| 40 | + | |
42 | 41 | | |
43 | 42 | | |
44 | 43 | | |
| |||
48 | 47 | | |
49 | 48 | | |
50 | 49 | | |
51 | | - | |
52 | | - | |
| 50 | + | |
53 | 51 | | |
54 | 52 | | |
55 | | - | |
56 | | - | |
| 53 | + | |
| 54 | + | |
57 | 55 | | |
58 | 56 | | |
Lines changed: 7 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
| 3 | + | |
6 | 4 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
15 | 10 | | |
16 | 11 | | |
17 | | - | |
18 | | - | |
| 12 | + | |
19 | 13 | | |
20 | 14 | | |
21 | 15 | | |
| |||
Lines changed: 3 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
| 5 | + | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
12 | | - | |
13 | | - | |
| 11 | + | |
14 | 12 | | |
15 | 13 | | |
16 | 14 | | |
17 | 15 | | |
18 | 16 | | |
19 | | - | |
20 | | - | |
| 17 | + | |
21 | 18 | | |
22 | 19 | | |
23 | 20 | | |
| |||
0 commit comments