Skip to content

Commit

Permalink
Remove unnecessary non-optional stringify method
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeehut committed Jun 5, 2018
1 parent 42db49f commit f875d73
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions Sources/Nimble/Utils/Stringers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ extension Data: TestOutputStringConvertible {
/// will return the result of constructing a string from the value.
///
/// - SeeAlso: `TestOutputStringConvertible`
public func stringify<T>(_ value: T) -> String {
public func stringify<T>(_ value: T?) -> String {
guard let value = value else { return "nil" }

if let value = value as? TestOutputStringConvertible {
return value.testDescription
}
Expand All @@ -156,14 +158,6 @@ public func stringify<T>(_ value: T) -> String {
return String(describing: value)
}

/// -SeeAlso: `stringify<T>(value: T)`
public func stringify<T>(_ value: T?) -> String {
if let unboxed = value {
return stringify(unboxed)
}
return "nil"
}

#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
@objc public class NMBStringer: NSObject {
@objc public class func stringify(_ obj: Any?) -> String {
Expand Down

0 comments on commit f875d73

Please sign in to comment.