macos: swiftlint 'for_where' rule

This commit is contained in:
Jon Parise
2026-02-20 19:39:25 -05:00
parent 5db9f03f62
commit 2d6fa92d78
5 changed files with 11 additions and 22 deletions

View File

@@ -18,7 +18,6 @@ disabled_rules:
- type_body_length
# TODO
- for_where
- force_cast
- multiple_closures_with_trailing_closure
- switch_case_alignment

View File

@@ -11,10 +11,8 @@ extension AppDelegate: Ghostty.Delegate {
continue
}
for surface in controller.surfaceTree {
if surface.id == id {
return surface
}
for surface in controller.surfaceTree where surface.id == id {
return surface
}
}

View File

@@ -1076,10 +1076,8 @@ class AppDelegate: NSObject,
func findSurface(forUUID uuid: UUID) -> Ghostty.SurfaceView? {
for c in TerminalController.all {
for view in c.surfaceTree {
if view.id == uuid {
return view
}
for view in c.surfaceTree where view.id == uuid {
return view
}
}

View File

@@ -131,11 +131,9 @@ class TerminalWindowRestoration: NSObject, NSWindowRestoration {
// Find the focused surface in surfaceTree
if let focusedStr = state.focusedSurface {
var foundView: Ghostty.SurfaceView?
for view in c.surfaceTree {
if view.id.uuidString == focusedStr {
foundView = view
break
}
for view in c.surfaceTree where view.id.uuidString == focusedStr {
foundView = view
break
}
if let view = foundView {

View File

@@ -52,10 +52,8 @@ extension NSView {
return true
}
for subview in subviews {
if subview.contains(view) {
return true
}
for subview in subviews where subview.contains(view) {
return true
}
return false
@@ -67,10 +65,8 @@ extension NSView {
return true
}
for subview in subviews {
if subview.contains(className: name) {
return true
}
for subview in subviews where contains(className: name) {
return true
}
return false