Silence unused result warnings for refresh outcome methods - #139
Merged
Conversation
refreshNow, performFullRefresh, and the binding-based load/loadIfIdle wrappers exist primarily for their side effects and surface errors internally, so most call sites ignore the returned RefreshOutcome. annotating them silences six unused-result warnings while callers that want the outcome (ios pull-to-refresh haptics, tests) still receive it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Changed
Marked five
RefreshOutcome-returning methods@discardableResult:TransmissionStore.refreshNow()andTransmissionStore.performFullRefresh(for:)Binding-basedload(for:using:showingError:errorMessage:)andloadIfIdle(for:using:showingError:errorMessage:)wrappers onTorrentDetailSupplementalStoreAlso removed the now-redundant
_ =discard inTransmissionStore.requestRefresh().Why
Xcode reported six "Result of call to '…' is unused" warnings across
macOSContentView,macOSTorrentDetail, andTransmissionStore. These methods exist primarily for their side effects and surface errors internally viaonErrorhandlers and error bindings, so most call sites legitimately ignore the returnedRefreshOutcome. Per SE-0047's guidance (and the SE-0520 precedent that madeTaskinitializers discardable for fire-and-forget use), the API author should annotate such methods rather than sprinkle_ =at every call site. Callers that want the outcome — iOS pull-to-refresh haptics and the test suite — still receive it.The core
onError-variantload/loadIfIdleonTorrentDetailSupplementalStoreremain unannotated since their callers all consume the result, keeping the warning as a guardrail there.Validation
BitDreamAppStoreDebug macOS build is clean: all six warnings resolved, no new warningsBitDreamscheme) passes:** TEST SUCCEEDED **swiftlint lint --quietreports no violations