     }
 
     private func isAlreadyTrailingClosure(dictionary: [String: SourceKitRepresentable], file: File) -> Bool {
-        guard let offset = (dictionary["key.offset"] as? Int64).flatMap({ Int($0) }),
-            let length = (dictionary["key.length"] as? Int64).flatMap({ Int($0) }),
+        guard let offset = dictionary.offset,
+            let length = dictionary.length,
             let text = file.contents.bridge().substringWithByteRange(start: offset, length: length) else {
                 return false
         }


        // check if there's only one unnamed parameter that is a closure
        if arguments.isEmpty,
            let offset = (dictionary["key.offset"] as? Int64).flatMap({ Int($0) }),
            let totalLength = (dictionary["key.length"] as? Int64).flatMap({ Int($0) }),
            let nameOffset = (dictionary["key.nameoffset"] as? Int64).flatMap({ Int($0) }),
            let nameLength = (dictionary["key.namelength"] as? Int64).flatMap({ Int($0) }),
            case let start = nameOffset + nameLength,
            case let length = totalLength + offset - start,
            let range = file.contents.bridge().byteRangeToNSRange(start: start, length: length),

    private func violationOffsets(for dictionary: [String: SourceKitRepresentable], file: File) -> [Int] {
        var results = [Int]()

        if dictionary.kind.flatMap(SwiftExpressionKind.init) == .call,
            shouldBeTrailingClosure(dictionary: dictionary, file: file),
            let offset = dictionary.offset {

            results = [offset]
        }

        if let kind = dictionary.kind.flatMap(StatementKind.init), kind != .brace {
            // trailing closures are not allowed in `if`, `guard`, etc
            results += dictionary.substructure.flatMap { subDict -> [Int] in
                guard subDict.kind.flatMap(StatementKind.init) == .brace else {
                    return []
                }

