Skip to content

Commit

Permalink
Merge pull request Quick#417 from ysk-tngc/issue_370/fix_unused_optio…
Browse files Browse the repository at this point in the history
…nal_binding_violation

[SwiftLint] fix unused optional binding vaiolation
  • Loading branch information
jeffh authored Apr 18, 2017
2 parents abc2c86 + 84877c9 commit 9ba8bfe
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Sources/Nimble/Matchers/BeginWith.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ extension NMBObjCMatcher {
public class func beginWithMatcher(_ expected: Any) -> NMBObjCMatcher {
return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in
let actual = try! actualExpression.evaluate()
if let _ = actual as? String {
if (actual as? String) != nil {
let expr = actualExpression.cast { $0 as? String }
return try! beginWith(expected as! String).matches(expr, failureMessage: failureMessage)
} else {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Nimble/Matchers/EndWith.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ extension NMBObjCMatcher {
public class func endWithMatcher(_ expected: Any) -> NMBObjCMatcher {
return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in
let actual = try! actualExpression.evaluate()
if let _ = actual as? String {
if (actual as? String) != nil {
let expr = actualExpression.cast { $0 as? String }
return try! endWith(expected as! String).matches(expr, failureMessage: failureMessage)
} else {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Nimble/Matchers/RaisesException.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ internal func setFailureMessageForException(
if let userInfo = userInfo {
failureMessage.postfixMessage += " with userInfo <\(userInfo)>"
}
if let _ = closure {
if closure != nil {
failureMessage.postfixMessage += " that satisfies block"
}
if named == nil && reason == nil && userInfo == nil && closure == nil {
Expand Down
4 changes: 2 additions & 2 deletions Sources/Nimble/Utils/Errors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal func setFailureMessageForError<T: Error>(
} else if errorType != nil || closure != nil {
failureMessage.postfixMessage += " from type <\(T.self)>"
}
if let _ = closure {
if closure != nil {
failureMessage.postfixMessage += " that satisfies block"
}
if error == nil && errorType == nil && closure == nil {
Expand Down Expand Up @@ -101,7 +101,7 @@ internal func setFailureMessageForError(
closure: ((Error) -> Void)?) {
failureMessage.postfixMessage = "throw error"

if let _ = closure {
if closure != nil {
failureMessage.postfixMessage += " that satisfies block"
} else {
failureMessage.postfixMessage = "throw any error"
Expand Down

0 comments on commit 9ba8bfe

Please sign in to comment.