Skip to content

Commit

Permalink
Removed Redundant returns
Browse files Browse the repository at this point in the history
  • Loading branch information
yakovmanshin committed May 17, 2024
1 parent 6aba5f1 commit f0fd45f
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 30 deletions.
21 changes: 7 additions & 14 deletions Tests/YMFFTests/Cases/FeatureFlagValueTransformerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,23 +81,16 @@ final class FeatureFlagValueTransformerTests: XCTestCase {
func test_valueFromRawValue_enumFromInt() {
let transformer = FeatureFlagValueTransformer { (age: Int) -> AgeGroup in
switch age {
case ..<13:
return .under13
case 13...17:
return .between13And17
case 18...:
return .over17
default:
return .under13
case ..<13: .under13
case 13...17: .between13And17
case 18...: .over17
default: .under13
}
} rawValueFromValue: { group in
switch group {
case .under13:
return 13
case .between13And17:
return 17
case .over17:
return 18
case .under13: 13
case .between13And17: 17
case .over17: 18
}
}

Expand Down
8 changes: 4 additions & 4 deletions Tests/YMFFTests/Utilities/FeatureFlagStoreMock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ extension FeatureFlagStoreMock: FeatureFlagStore {
func value<Value>(for key: FeatureFlagKey) async -> Result<Value, FeatureFlagStoreError> {
value_invocationCount += 1
value_keys.append(key)
switch value_result! {
return switch value_result! {
case .success(let anyValue):
if let value = anyValue as? Value {
return .success(value)
.success(value)
} else {
return .failure(.typeMismatch)
.failure(.typeMismatch)
}
case .failure(let error): return .failure(error)
case .failure(let error): .failure(error)
}
}

Expand Down
8 changes: 4 additions & 4 deletions Tests/YMFFTests/Utilities/MutableFeatureFlagStoreMock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ extension MutableFeatureFlagStoreMock: MutableFeatureFlagStore {
func value<Value>(for key: FeatureFlagKey) async -> Result<Value, FeatureFlagStoreError> {
value_invocationCount += 1
value_keys.append(key)
switch value_result! {
return switch value_result! {
case .success(let anyValue):
if let value = anyValue as? Value {
return .success(value)
.success(value)
} else {
return .failure(.typeMismatch)
.failure(.typeMismatch)
}
case .failure(let error): return .failure(error)
case .failure(let error): .failure(error)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ extension SynchronousFeatureFlagStoreMock: SynchronousFeatureFlagStore {
func valueSync<Value>(for key: FeatureFlagKey) -> Result<Value, FeatureFlagStoreError> {
valueSync_invocationCount += 1
valueSync_keys.append(key)
switch valueSync_result! {
return switch valueSync_result! {
case .success(let anyValue):
if let value = anyValue as? Value {
return .success(value)
.success(value)
} else {
return .failure(.typeMismatch)
.failure(.typeMismatch)
}
case .failure(let error): return .failure(error)
case .failure(let error): .failure(error)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ extension SynchronousMutableFeatureFlagStoreMock: SynchronousMutableFeatureFlagS
func valueSync<Value>(for key: FeatureFlagKey) -> Result<Value, FeatureFlagStoreError> {
valueSync_invocationCount += 1
valueSync_keys.append(key)
switch valueSync_result! {
return switch valueSync_result! {
case .success(let anyValue):
if let value = anyValue as? Value {
return .success(value)
.success(value)
} else {
return .failure(.typeMismatch)
.failure(.typeMismatch)
}
case .failure(let error): return .failure(error)
case .failure(let error): .failure(error)
}
}

Expand Down

0 comments on commit f0fd45f

Please sign in to comment.