Skip to content

Ignore unowned(unsafe) captures by default#6824

Open
Yurii201811 wants to merge 1 commit into
realm:mainfrom
Yurii201811:fix/unowned-unsafe-captures
Open

Ignore unowned(unsafe) captures by default#6824
Yurii201811 wants to merge 1 commit into
realm:mainfrom
Yurii201811:fix/unowned-unsafe-captures

Conversation

@Yurii201811

Copy link
Copy Markdown

Summary

Ignore unowned(unsafe) captures by default while preserving an opt-in include_unsafe setting.

Background

The explicit unsafe spelling communicates the intended lifetime tradeoff.

Closes #6817

Changes

  • add include_unsafe, defaulting to false
  • distinguish unsafe capture specifiers from unowned and unowned(safe)
  • cover default and configured behavior
  • update generated configuration metadata and changelog

Verification

  • generated rule tests
  • full Swift tests
  • SwiftLint self-lint
  • remaining platform gates or CI

@Yurii201811
Yurii201811 marked this pull request as ready for review July 13, 2026 08:45
@SwiftLintBot

Copy link
Copy Markdown
19 Messages
📖 Building this branch resulted in a binary size of 28378.98 KiB vs 28357.8 KiB when built on main (0% larger).
📖 Linting Aerial with this PR took 0.67 s vs 0.69 s on main (2% faster).
📖 Linting Alamofire with this PR took 0.93 s vs 0.91 s on main (2% slower).
📖 Linting Brave with this PR took 5.97 s vs 5.97 s on main (0% slower).
📖 Linting DuckDuckGo with this PR took 25.82 s vs 25.9 s on main (0% faster).
📖 Linting Firefox with this PR took 10.36 s vs 10.44 s on main (0% faster).
📖 Linting Kickstarter with this PR took 7.31 s vs 7.35 s on main (0% faster).
📖 Linting Moya with this PR took 0.37 s vs 0.38 s on main (2% faster).
📖 Linting NetNewsWire with this PR took 2.34 s vs 2.36 s on main (0% faster).
📖 Linting Nimble with this PR took 0.53 s vs 0.57 s on main (7% faster).
📖 Linting PocketCasts with this PR took 6.9 s vs 6.9 s on main (0% slower).
📖 Linting Quick with this PR took 0.33 s vs 0.36 s on main (8% faster).
📖 Linting Realm with this PR took 2.41 s vs 2.42 s on main (0% faster).
📖 Linting Sourcery with this PR took 1.47 s vs 1.5 s on main (2% faster).
📖 Linting Swift with this PR took 4.21 s vs 4.24 s on main (0% faster).
📖 Linting SwiftLintPerformanceTests with this PR took 0.16 s vs 0.16 s on main (0% slower).
📖 Linting VLC with this PR took 1.11 s vs 1.08 s on main (2% slower).
📖 Linting Wire with this PR took 15.19 s vs 15.15 s on main (0% slower).
📖 Linting WordPress with this PR took 9.65 s vs 9.67 s on main (0% faster).

Generated by 🚫 Danger

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

unowned_variable_capture fires for unowned(unsafe) captures

2 participants