Skip to content

Commit

Permalink
Fix exhaustive case warnings
Browse files Browse the repository at this point in the history
Starting with Crystal 0.34.0 case expressions issue a warning when
exhaustiveness can't be proven. This adds the missing else branches to
encode the default behaviour.
  • Loading branch information
straight-shoota authored and will committed Apr 6, 2020
1 parent 8297465 commit c6448b7
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/pg/escape_helper.cr
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ module PG
num_backslashes += 1
when quote_char
num_quotes += 1
else
# skip
end
end

Expand All @@ -76,6 +78,8 @@ module PG
build << quote_char
when '\\'
build << '\\' unless as_ident
else
# ignore
end
build << c
end
Expand Down
2 changes: 2 additions & 0 deletions src/pq/connection.cr
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@ module PQ
raise ConnectionError.new(
"Only on is supported for integer_datetimes, got: #{frame.value.inspect}")
end
else
# ignore
end
end

Expand Down
2 changes: 2 additions & 0 deletions src/pq/conninfo.cr
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ module PQ
@sslkey = value
when "sslrootcert"
@sslrootcert = value
else
# ignore
end
end

Expand Down
1 change: 1 addition & 0 deletions src/pq/frame.cr
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module PQ
when 'S' then ParameterStatus
when 'K' then BackendKeyData
when 'R' then Authentication
else nil
end
k ? k.new(bytes) : Unknown.new(type, bytes)
end
Expand Down
2 changes: 2 additions & 0 deletions src/pq/notice.cr
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ module PQ
code = f.message
when :message
message = f.message
else
# ignore
end
end

Expand Down

0 comments on commit c6448b7

Please sign in to comment.