Skip to content

Commit

Permalink
prefer let for variable that does not need to be mutated.
Browse files Browse the repository at this point in the history
  • Loading branch information
mattpolzin committed Mar 1, 2024
1 parent 93efa69 commit cae14e9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Sources/JSONAPI/Resource/Relationship.swift
Original file line number Diff line number Diff line change
Expand Up @@ -402,9 +402,11 @@ extension ToManyRelationship: Codable {
}

let hasData = container.contains(.data)
var canHaveNoDataInRelationships: Bool = false
let canHaveNoDataInRelationships: Bool
if let relatableType = Relatable.self as? ResourceObjectWithOptionalDataInRelationships.Type {
canHaveNoDataInRelationships = relatableType.canHaveNoDataInRelationships
} else {
canHaveNoDataInRelationships = false
}
guard hasData || !canHaveNoDataInRelationships else {
idsWithMeta = []
Expand Down

0 comments on commit cae14e9

Please sign in to comment.