mirror of
https://github.com/nicklockwood/SwiftFormat.git
synced 2026-05-17 10:30:35 +00:00
32 lines
677 B
Swift
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()
|
|
}
|
|
}
|
|
```
|
|
"""
|
|
}
|
|
}
|