Files
SwiftFormat/Sources/Rules/RedundantStaticSelf.swift
2024-11-16 20:23:01 +00:00

32 lines
677 B
Swift

//
// RedundantStaticSelf.swift
// SwiftFormat
//
// Created by Šimon Javora on 4/29/23.
// Copyright © 2024 Nick Lockwood. All rights reserved.
//
import Foundation
public extension FormatRule {
/// Remove redundant Self keyword
static let redundantStaticSelf = FormatRule(
help: "Remove explicit `Self` where applicable."
) { formatter in
formatter.addOrRemoveSelf(static: true)
} examples: {
"""
```diff
enum Foo {
static let bar = Bar()
static func baaz() -> Bar {
- Self.bar()
+ bar()
}
}
```
"""
}
}