Skip to content

Commit

Permalink
[unused_closure_parameter] Check if self is a keyword to prevent pote…
Browse files Browse the repository at this point in the history
…ntial issues

This was suggested by @[marcelofabri](/marcelofabri) here:
realm#2639 (comment)
  • Loading branch information
Jeehut authored and sjavora committed Mar 9, 2019
1 parent 62b2ea9 commit 005f967
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ public struct UnusedClosureParameterRule: SubstitutionCorrectableASTRule, Config
}

let token = tokens.first(where: { token -> Bool in
return (SyntaxKind(rawValue: token.type) == .identifier || name == "self") &&
return (SyntaxKind(rawValue: token.type) == .identifier
|| (SyntaxKind(rawValue: token.type) == .keyword && name == "self")) &&
token.offset == byteRange.location &&
token.length == byteRange.length
})
Expand Down

0 comments on commit 005f967

Please # to comment.