Skip to content

Commit 4bf5287

Browse files
committed
Add 'removeUnusedLambdaParameters' to the cleanup settings.
Signed-off-by: Roland Grunberg <[email protected]>
1 parent 86c2adf commit 4bf5287

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

document/_java.learnMoreAboutCleanUps.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,4 +405,30 @@ public class A {
405405
Parser a12;
406406
}
407407
}
408+
```
409+
410+
### `removeUnusedLambdaParameters`
411+
412+
Rename unused lambda parameters, or unused pattern variables to `_`.
413+
414+
For example:
415+
416+
```java
417+
J j = (a, b) -> System.out.println(a);
418+
419+
switch (r) {
420+
case R(_, long l) -> {}
421+
case R r2 -> {}
422+
}
423+
```
424+
425+
becomes:
426+
427+
```java
428+
J j = (a, _) -> System.out.println(a);
429+
430+
switch (r) {
431+
case R(_, _) -> {}
432+
case R _ -> {}
433+
}
408434
```

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1313,7 +1313,8 @@
13131313
"switchExpression",
13141314
"tryWithResource",
13151315
"renameFileToType",
1316-
"organizeImports"
1316+
"organizeImports",
1317+
"removeUnusedLambdaParameters"
13171318
]
13181319
},
13191320
"default": [

0 commit comments

Comments
 (0)