Skip to content

Commit

Permalink
Merge pull request #5 from RakuyoKit/feature/trailingClosures
Browse files Browse the repository at this point in the history
Remove `trailingClosures`
  • Loading branch information
rakuyoMo authored Apr 16, 2024
2 parents 77a8b26 + 46bacd5 commit f95292e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 23 deletions.
22 changes: 0 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2183,28 +2183,6 @@ _You can enable the following settings in Xcode by running [this script](resourc

</details>

* <a id='anonymous-trailing-closures'></a>(<a href='#anonymous-trailing-closures'>link</a>) **Prefer trailing closure syntax for closure arguments with no parameter name.** [![SwiftFormat: trailingClosures](https://img.shields.io/badge/SwiftFormat-trailingClosures-7B0051.svg)](https://github.com/nicklockwood/SwiftFormat/blob/master/Rules.md#trailingClosures)

<details>

```swift
// WRONG
planets.map({ $0.name })

// RIGHT
planets.map { $0.name }

// ALSO RIGHT, since this closure has a parameter name
planets.first(where: { $0.isGasGiant })

// ALSO FINE. Trailing closure syntax is still permitted for closures
// with parameter names. However, consider using non-trailing syntax
// in cases where the parameter name is semantically meaningful.
planets.first { $0.isGasGiant }
```

</details>

* <a id='unowned-captures'></a>(<a href='#unowned-captures'>link</a>) **Avoid using `unowned` captures.** Instead prefer safer alternatives like `weak` captures, or capturing variables directly. [![SwiftLint: unowned_variable_capture](https://img.shields.io/badge/SwiftLint-unowned__variable__capture-007A87.svg)](https://realm.github.io/SwiftLint/unowned_variable_capture.html)

<details>
Expand Down
1 change: 0 additions & 1 deletion Sources/RakuyoSwiftFormatTool/rakuyo.swiftformat
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@
--rules andOperator
--rules opaqueGenericParameters
--rules genericExtensions
--rules trailingClosures
--rules elseOnSameLine
--rules sortTypealiases
--rules preferForLoop
Expand Down

0 comments on commit f95292e

Please sign in to comment.