diff --git a/Sources/Nimble/Adapters/NMBExpectation.swift b/Sources/Nimble/Adapters/NMBExpectation.swift index b3eb09a94..5338a4656 100644 --- a/Sources/Nimble/Adapters/NMBExpectation.swift +++ b/Sources/Nimble/Adapters/NMBExpectation.swift @@ -54,49 +54,49 @@ public class NMBExpectation: NSObject { } @objc public var withTimeout: (TimeInterval) -> NMBExpectation { - return ({ timeout in self._timeout = timeout + return { timeout in self._timeout = timeout return self - }) + } } @objc public var to: (NMBMatcher) -> Void { - return ({ matcher in + return { matcher in if let pred = matcher as? NMBPredicate { self.expectValue.to(from(objcPredicate: pred)) } else { self.expectValue.to(ObjCMatcherWrapper(matcher: matcher)) } - }) + } } @objc public var toWithDescription: (NMBMatcher, String) -> Void { - return ({ matcher, description in + return { matcher, description in if let pred = matcher as? NMBPredicate { self.expectValue.to(from(objcPredicate: pred), description: description) } else { self.expectValue.to(ObjCMatcherWrapper(matcher: matcher), description: description) } - }) + } } @objc public var toNot: (NMBMatcher) -> Void { - return ({ matcher in + return { matcher in if let pred = matcher as? NMBPredicate { self.expectValue.toNot(from(objcPredicate: pred)) } else { self.expectValue.toNot(ObjCMatcherWrapper(matcher: matcher)) } - }) + } } @objc public var toNotWithDescription: (NMBMatcher, String) -> Void { - return ({ matcher, description in + return { matcher, description in if let pred = matcher as? NMBPredicate { self.expectValue.toNot(from(objcPredicate: pred), description: description) } else { self.expectValue.toNot(ObjCMatcherWrapper(matcher: matcher), description: description) } - }) + } } @objc public var notTo: (NMBMatcher) -> Void { return toNot } @@ -104,7 +104,7 @@ public class NMBExpectation: NSObject { @objc public var notToWithDescription: (NMBMatcher, String) -> Void { return toNotWithDescription } @objc public var toEventually: (NMBMatcher) -> Void { - return ({ matcher in + return { matcher in if let pred = matcher as? NMBPredicate { self.expectValue.toEventually( from(objcPredicate: pred), @@ -118,11 +118,11 @@ public class NMBExpectation: NSObject { description: nil ) } - }) + } } @objc public var toEventuallyWithDescription: (NMBMatcher, String) -> Void { - return ({ matcher, description in + return { matcher, description in if let pred = matcher as? NMBPredicate { self.expectValue.toEventually( from(objcPredicate: pred), @@ -136,11 +136,11 @@ public class NMBExpectation: NSObject { description: description ) } - }) + } } @objc public var toEventuallyNot: (NMBMatcher) -> Void { - return ({ matcher in + return { matcher in if let pred = matcher as? NMBPredicate { self.expectValue.toEventuallyNot( from(objcPredicate: pred), @@ -154,11 +154,11 @@ public class NMBExpectation: NSObject { description: nil ) } - }) + } } @objc public var toEventuallyNotWithDescription: (NMBMatcher, String) -> Void { - return ({ matcher, description in + return { matcher, description in if let pred = matcher as? NMBPredicate { self.expectValue.toEventuallyNot( from(objcPredicate: pred), @@ -172,7 +172,7 @@ public class NMBExpectation: NSObject { description: description ) } - }) + } } @objc public var toNotEventually: (NMBMatcher) -> Void { diff --git a/Sources/Nimble/Expression.swift b/Sources/Nimble/Expression.swift index b6b2ee30f..dcc42e4e3 100644 --- a/Sources/Nimble/Expression.swift +++ b/Sources/Nimble/Expression.swift @@ -4,12 +4,12 @@ import Foundation // closure once; even if repeat calls to the returned closure internal func memoizedClosure(_ closure: @escaping () throws -> T) -> (Bool) throws -> T { var cache: T? - return ({ withoutCaching in + return { withoutCaching in if withoutCaching || cache == nil { cache = try closure() } return cache! - }) + } } /// Expression represents the closure of the value inside expect(...). diff --git a/Sources/Nimble/Matchers/BeCloseTo.swift b/Sources/Nimble/Matchers/BeCloseTo.swift index c82d1972e..4396180a4 100644 --- a/Sources/Nimble/Matchers/BeCloseTo.swift +++ b/Sources/Nimble/Matchers/BeCloseTo.swift @@ -81,9 +81,9 @@ public class NMBObjCBeCloseToMatcher: NSObject, NMBMatcher { } @objc public var within: (CDouble) -> NMBObjCBeCloseToMatcher { - return ({ delta in + return { delta in return NMBObjCBeCloseToMatcher(expected: self._expected, within: delta) - }) + } } } diff --git a/Sources/Nimble/Matchers/MatcherProtocols.swift b/Sources/Nimble/Matchers/MatcherProtocols.swift index 202e6db1f..21ffd7719 100644 --- a/Sources/Nimble/Matchers/MatcherProtocols.swift +++ b/Sources/Nimble/Matchers/MatcherProtocols.swift @@ -18,13 +18,13 @@ extension Matcher { } var toClosure: (Expression, FailureMessage, Bool) throws -> Bool { - return ({ expr, msg, expectedResult in + return { expr, msg, expectedResult in if expectedResult { return try self.matches(expr, failureMessage: msg) } else { return try self.doesNotMatch(expr, failureMessage: msg) } - }) + } } } diff --git a/Sources/Nimble/Matchers/RaisesException.swift b/Sources/Nimble/Matchers/RaisesException.swift index f4ce64e99..4dd930442 100644 --- a/Sources/Nimble/Matchers/RaisesException.swift +++ b/Sources/Nimble/Matchers/RaisesException.swift @@ -161,47 +161,47 @@ public class NMBObjCRaiseExceptionMatcher: NSObject, NMBMatcher { } @objc public var named: (_ name: String) -> NMBObjCRaiseExceptionMatcher { - return ({ name in + return { name in return NMBObjCRaiseExceptionMatcher( name: name, reason: self._reason, userInfo: self._userInfo, block: self._block ) - }) + } } @objc public var reason: (_ reason: String?) -> NMBObjCRaiseExceptionMatcher { - return ({ reason in + return { reason in return NMBObjCRaiseExceptionMatcher( name: self._name, reason: reason, userInfo: self._userInfo, block: self._block ) - }) + } } @objc public var userInfo: (_ userInfo: NSDictionary?) -> NMBObjCRaiseExceptionMatcher { - return ({ userInfo in + return { userInfo in return NMBObjCRaiseExceptionMatcher( name: self._name, reason: self._reason, userInfo: userInfo, block: self._block ) - }) + } } @objc public var satisfyingBlock: (_ block: ((NSException) -> Void)?) -> NMBObjCRaiseExceptionMatcher { - return ({ block in + return { block in return NMBObjCRaiseExceptionMatcher( name: self._name, reason: self._reason, userInfo: self._userInfo, block: block ) - }) + } } }