Skip to content

Commit

Permalink
Swapped force-unwrap for conditional unwrap; formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
orchetect committed Jul 25, 2022
1 parent 38188a5 commit 6a82572
Showing 1 changed file with 28 additions and 16 deletions.
44 changes: 28 additions & 16 deletions Sources/SwiftRadix/Radix/Radix Operators.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,31 +50,43 @@ extension Radix {
}

@inlinable
public func == <T: BinaryInteger, Other>(lhs: Radix<T>?, rhs: Other) -> Bool
where Other: BinaryInteger {
if lhs == nil { return false }
return lhs!.value == rhs
public func == <
T: BinaryInteger,
O: BinaryInteger
>(lhs: Radix<T>?, rhs: O) -> Bool {
guard let lhs = lhs else { return false }
return lhs.value == rhs
}

@inlinable
public func == <T: BinaryInteger, Other>(lhs: Other, rhs: Radix<T>?) -> Bool
where Other: BinaryInteger {
if rhs == nil { return false }
return lhs == rhs!.value
public func == <
T: BinaryInteger,
O: BinaryInteger
>(lhs: O, rhs: Radix<T>?) -> Bool {
guard let rhs = rhs else { return false }
return lhs == rhs.value
}

@inlinable
public func != <T: BinaryInteger, Other>(lhs: Radix<T>?, rhs: Other) -> Bool
where Other: BinaryInteger {
if lhs == nil { return false }
return lhs!.value != rhs
public func != <
T: BinaryInteger,
O: BinaryInteger
>(
lhs: Radix<T>?, rhs: O
) -> Bool {
guard let lhs = lhs else { return false }
return lhs.value != rhs
}

@inlinable
public func != <T: BinaryInteger, Other>(lhs: Other, rhs: Radix<T>?) -> Bool
where Other: BinaryInteger {
if rhs == nil { return false }
return lhs != rhs!.value
public func != <
T: BinaryInteger,
O: BinaryInteger
>(
lhs: O, rhs: Radix<T>?
) -> Bool {
guard let rhs = rhs else { return false }
return lhs != rhs.value
}

// MARK: - Comparable
Expand Down

0 comments on commit 6a82572

Please sign in to comment.