From 2e3effbd5b58059b619a9d80b25ae24ba04e7e0d Mon Sep 17 00:00:00 2001 From: Jonathan Sibley Date: Wed, 21 Sep 2016 16:10:13 -0700 Subject: [PATCH] Add the @discardableResult attribute to a Disposable.add overload According to the documentation comment (and correctly so, IMO), it seems like the return value of this `Disposable.add` function overload is discardable. --- Sources/Disposable.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Sources/Disposable.swift b/Sources/Disposable.swift index 6f2bc5aef..71962bd5b 100644 --- a/Sources/Disposable.swift +++ b/Sources/Disposable.swift @@ -185,6 +185,7 @@ public final class CompositeDisposable: Disposable { /// /// - returns: An instance of `DisposableHandle` that can be used to /// opaquely remove the disposable later (if desired). + @discardableResult public func add(_ action: @escaping () -> Void) -> DisposableHandle { return add(ActionDisposable(action: action)) }