Skip to content

Commit

Permalink
Declare ConfigurationElement as Equatable right away
Browse files Browse the repository at this point in the history
  • Loading branch information
SimplyDanny committed Nov 4, 2023
1 parent 45e1961 commit e746033
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions Source/SwiftLintCore/Models/RuleConfigurationDescription.swift
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ public protocol InlinableOptionType: AcceptableByConfigurationElement {}
/// error: 2
/// ```
@propertyWrapper
public struct ConfigurationElement<T: AcceptableByConfigurationElement & Equatable> {
public struct ConfigurationElement<T: AcceptableByConfigurationElement & Equatable>: Equatable {
/// Wrapped option value.
public var wrappedValue: T

Expand Down Expand Up @@ -445,6 +445,10 @@ public struct ConfigurationElement<T: AcceptableByConfigurationElement & Equatab
public mutating func performAfterParseOperations() throws {
try postprocessor(&wrappedValue)
}

public static func == (lhs: ConfigurationElement, rhs: ConfigurationElement) -> Bool {
lhs.wrappedValue == rhs.wrappedValue && lhs.key == rhs.key
}
}

extension ConfigurationElement: AnyConfigurationElement {
Expand All @@ -453,12 +457,6 @@ extension ConfigurationElement: AnyConfigurationElement {
}
}

extension ConfigurationElement: Equatable {
public static func == (lhs: ConfigurationElement, rhs: ConfigurationElement) -> Bool {
lhs.wrappedValue == rhs.wrappedValue && lhs.key == rhs.key
}
}

// MARK: AcceptableByConfigurationElement conformances

extension Optional: AcceptableByConfigurationElement where Wrapped: AcceptableByConfigurationElement {
Expand Down

0 comments on commit e746033

Please sign in to comment.