Skip to content

Commit

Permalink
Avoid forced unwrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
ikesyo committed Jul 18, 2018
1 parent 39db3c9 commit 9bbe098
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/Nimble/Matchers/Contain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public func contain(_ items: [Any?]) -> Predicate<NMBContainer> {
return Predicate.simple("contain <\(arrayAsString(items))>") { actualExpression in
guard let actual = try actualExpression.evaluate() else { return .fail }
let matches = items.all { item in
return item != nil && actual.contains(item!)
return item.map { actual.contains($0) } ?? false
}
return PredicateStatus(bool: matches)
}
Expand Down

0 comments on commit 9bbe098

Please sign in to comment.