From e7460339d4abe7c481a03f2904a6e78b265efb9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danny=20M=C3=B6sch?= Date: Sat, 4 Nov 2023 21:38:49 +0100 Subject: [PATCH] Declare ConfigurationElement as Equatable right away --- .../Models/RuleConfigurationDescription.swift | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Source/SwiftLintCore/Models/RuleConfigurationDescription.swift b/Source/SwiftLintCore/Models/RuleConfigurationDescription.swift index 82296a8082..20f8802a5c 100644 --- a/Source/SwiftLintCore/Models/RuleConfigurationDescription.swift +++ b/Source/SwiftLintCore/Models/RuleConfigurationDescription.swift @@ -390,7 +390,7 @@ public protocol InlinableOptionType: AcceptableByConfigurationElement {} /// error: 2 /// ``` @propertyWrapper -public struct ConfigurationElement { +public struct ConfigurationElement: Equatable { /// Wrapped option value. public var wrappedValue: T @@ -445,6 +445,10 @@ public struct ConfigurationElement Bool { + lhs.wrappedValue == rhs.wrappedValue && lhs.key == rhs.key + } } extension ConfigurationElement: AnyConfigurationElement { @@ -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 {