The cancel path keeps its selection, not a void helper - #335
Merged
Merged
Conversation
3lvis
marked this pull request as ready for review
September 16, 2026 21:11
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.
Why
cancelRequestwas a void helper with one caller, disabled againstno_single_use_void_functions. Underneath it was a pure question — which task carries this method and URL — wrapped in an effect that was one line long.That question is now
firstTask(matching:url:among:), which returns the task and touches nothing.cancelImageDownloadreads the session's tasks and cancels what comes back, which is the whole of what the helper was doing for it.Two things fell out. The
SessionTaskTypeswitch offered.data,.uploadand.download, and the only caller ever passed.data— the enum had no other user in the package, so it goes with the switch. And the disable comment goes, leaving eight in the package rather than nine.The approach
I tried the same split on
logCompletionand reverted it. Its fiverecordcalls were what keptrecordabove the rule's single-caller line; extracting the pure line-builder moved the violation ontorecordinstead of removing it, andrecordis a file-handle writer that has no business being inlined into a loop. One disable traded for another is not worth a diff.Behaviour is unchanged, and
testCancelImageDownloadcovers this path already, so there is no new test here.Testing
make test(180 tests, green) plusbin/lint --checkclean.Learnings
A single-use void helper can be the reason a different function clears the same rule.
logCompletioncalledrecordfive times, sorecordread as multi-use; pulling the pure half out oflogCompletionleftrecordwith one caller and the rule moved rather than cleared. Worth counting the callers a refactor removes before assuming an extraction pays.