You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
unowned_variable_capture fires for unowned(unsafe) captures #6817
enhancementIdeas for improvements of existing features and rules.good first issueIssue to be taken up by new contributors yet unfamiliar with the project.
the unowned_variable_capture rule currently fires not only for unowned captures, but also for unowned(unsafe) captures.
IMO this is excessive, as the unsafe addition already makes clear the programmer's intent to trade safety for performance here, and guarantee that the captured value's lifetime will exceed that of the closure.
suggestion: unowned_variable_capture should fire only for unowned captures, but not for unowned(unsafe) ones.
looking at the rule's documentation, it seems like this should be the behaviour anyway, as the "triggering examples" section lists only unowned captures but no unowned(unsafe) ones.
unowned(unsafe) is a new feature the rule hasn't considered yet. It should probably be handled with a new option that either makes the rule check or ignore it.
@SimplyDanny it's not particularly new; it has been around since the very beginning i believe.
imo the way this should be handled it to add an option to the rule, to control whether it also covers unowned(unsafe) captures (and have that default to false)
I am working on this following the configuration approach discussed here: ignore unowned(unsafe) by default and add an opt-in include_unsafe setting, with rule examples and changelog coverage.
enhancementIdeas for improvements of existing features and rules.good first issueIssue to be taken up by new contributors yet unfamiliar with the project.
Activity
SimplyDanny commentedon Jul 10, 2026
unowned(unsafe)is a new feature the rule hasn't considered yet. It should probably be handled with a new option that either makes the rule check or ignore it.lukaskollmer commentedon Jul 10, 2026
@SimplyDanny it's not particularly new; it has been around since the very beginning i believe.
imo the way this should be handled it to add an option to the rule, to control whether it also covers
unowned(unsafe)captures (and have that default to false)Yurii201811 commentedon Jul 13, 2026
I am working on this following the configuration approach discussed here: ignore
unowned(unsafe)by default and add an opt-ininclude_unsafesetting, with rule examples and changelog coverage.