Use .filter instead of .compactMap in Validation.safeSubvalidations property

This commit is contained in:
Caleb Kleveter 2018-12-03 08:32:05 -06:00
parent f1058cfb6f
commit 7cf275eb06
No known key found for this signature in database
GPG Key ID: B38DBD5CF2C98D69
1 changed files with 1 additions and 4 deletions

View File

@ -95,10 +95,7 @@ extension Validation {
/// Subvalidations that expect an input type that matches the validation's `Support` type.
public static var safeSubvalidations: [AnyValidation.Type] {
return self.subvalidations.compactMap { validation in
guard validation.type == Supported.self else { return nil }
return validation
}
return self.subvalidations.filter { $0.type == Supported.self }
}
/// Runs the currenct validation and any subvalidations that support the `Supported` type.