Deprecate `unused_capture_list` rule in favor of the Swift compiler warning (#4656)
This commit is contained in:
parent
1a39194f65
commit
d76daf5f62
|
@ -2,7 +2,10 @@
|
|||
|
||||
#### Breaking
|
||||
|
||||
* None.
|
||||
* Deprecate the `unused_capture_list` rule in favor of the Swift compiler
|
||||
warning. At the same time, make it an opt-in rule.
|
||||
[Cyberbeni](https://github.com/Cyberbeni)
|
||||
[#4656](https://github.com/realm/SwiftLint/issues/4656)
|
||||
|
||||
#### Experimental
|
||||
|
||||
|
|
|
@ -1,6 +1,18 @@
|
|||
import SwiftSyntax
|
||||
|
||||
struct UnusedCaptureListRule: SwiftSyntaxRule, ConfigurationProviderRule {
|
||||
private let warnDeprecatedOnceImpl: Void = {
|
||||
queuedPrintError("""
|
||||
The `\(UnusedCaptureListRule.description.identifier)` rule is now deprecated and will be completely \
|
||||
removed in a future release due to an equivalent warning issued by the Swift compiler.
|
||||
"""
|
||||
)
|
||||
}()
|
||||
|
||||
private func warnDeprecatedOnce() {
|
||||
_ = warnDeprecatedOnceImpl
|
||||
}
|
||||
|
||||
struct UnusedCaptureListRule: SwiftSyntaxRule, ConfigurationProviderRule, OptInRule {
|
||||
var configuration = SeverityConfiguration(.warning)
|
||||
|
||||
init() {}
|
||||
|
@ -121,7 +133,8 @@ struct UnusedCaptureListRule: SwiftSyntaxRule, ConfigurationProviderRule {
|
|||
)
|
||||
|
||||
func makeVisitor(file: SwiftLintFile) -> ViolationsSyntaxVisitor {
|
||||
Visitor(viewMode: .sourceAccurate)
|
||||
warnDeprecatedOnce()
|
||||
return Visitor(viewMode: .sourceAccurate)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue