From aee8e3961cc215af7c33227b4bab84baac3e00ac Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Tue, 5 May 2026 04:34:33 +1000 Subject: [PATCH] Enable SwiftLint rule: contains_over_first_not_nil Adds the rule to `only_rules`. The rule prefers `xs.contains { ... }` over `xs.first(where: { ... }) != nil` (and the `firstIndex` variant), which is a performance and clarity win. Part of the Orchard SwiftLint rollout campaign. --- Generated with the help of Claude Code, https://claude.ai/code Co-Authored-By: Claude Code Opus 4.7 --- .swiftlint.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.swiftlint.yml b/.swiftlint.yml index ef8311c1..3a4e3a61 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -20,6 +20,9 @@ only_rules: # Prefer `contains` over using `filter(where:).isEmpty`. - contains_over_filter_is_empty + # Prefer `contains` over `first(where:) != nil`. + - contains_over_first_not_nil + # if,for,while,do statements shouldn't wrap their conditionals in parentheses. - control_statement