Skip to content

Commit

Permalink
Add 'removeUnusedLambdaParameters' to the cleanup settings.
Browse files Browse the repository at this point in the history
Signed-off-by: Roland Grunberg <[email protected]>
  • Loading branch information
rgrunber committed Nov 13, 2024
1 parent 86c2adf commit 4bf5287
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
26 changes: 26 additions & 0 deletions document/_java.learnMoreAboutCleanUps.md
Original file line number Diff line number Diff line change
Expand Up @@ -405,4 +405,30 @@ public class A {
Parser a12;
}
}
```

### `removeUnusedLambdaParameters`

Rename unused lambda parameters, or unused pattern variables to `_`.

For example:

```java
J j = (a, b) -> System.out.println(a);

switch (r) {
case R(_, long l) -> {}
case R r2 -> {}
}
```

becomes:

```java
J j = (a, _) -> System.out.println(a);

switch (r) {
case R(_, _) -> {}
case R _ -> {}
}
```
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1313,7 +1313,8 @@
"switchExpression",
"tryWithResource",
"renameFileToType",
"organizeImports"
"organizeImports",
"removeUnusedLambdaParameters"
]
},
"default": [
Expand Down

0 comments on commit 4bf5287

Please sign in to comment.