Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BufferMessageEncoder] Reduce the number of force unwraps #234

Merged
merged 1 commit into from
Feb 26, 2022

Conversation

fabianfett
Copy link
Collaborator

Motivation

The fewer force unwraps, the better

Changes

  • Remove an Optional return type, that doesn't need to be an optional return type

Result

Safer code, thanks to fewer force unwraps.

@fabianfett fabianfett requested a review from gwynne February 26, 2022 10:48
@codecov-commenter
Copy link

codecov-commenter commented Feb 26, 2022

Codecov Report

Merging #234 (38c980f) into main (4cd1567) will increase coverage by 4.06%.
The diff coverage is 46.15%.

@@            Coverage Diff             @@
##             main     #234      +/-   ##
==========================================
+ Coverage   39.83%   43.89%   +4.06%     
==========================================
  Files         116      116              
  Lines        9417     9420       +3     
==========================================
+ Hits         3751     4135     +384     
+ Misses       5666     5285     -381     
Flag Coverage Δ
unittests 43.89% <46.15%> (+4.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
Sources/PostgresNIO/New/PSQLChannelHandler.swift 60.53% <41.66%> (+10.86%) ⬆️
...urces/PostgresNIO/New/BufferedMessageEncoder.swift 100.00% <100.00%> (+8.00%) ⬆️
Sources/PostgresNIO/New/PSQLRow-multi-decode.swift 4.44% <0.00%> (+0.19%) ⬆️
Sources/PostgresNIO/Data/PostgresRow.swift 50.00% <0.00%> (+1.02%) ⬆️
...s/PostgresNIO/New/Data/Array+PostgresCodable.swift 94.68% <0.00%> (+1.06%) ⬆️
...rces/PostgresNIO/New/Extensions/Logging+PSQL.swift 19.60% <0.00%> (+1.42%) ⬆️
Sources/PostgresNIO/New/PSQLConnection.swift 30.00% <0.00%> (+2.10%) ⬆️
...ostgresNIO/Deprecated/PostgresMessageDecoder.swift 95.45% <0.00%> (+2.27%) ⬆️
...es/PostgresNIO/New/PSQLBackendMessageDecoder.swift 93.28% <0.00%> (+2.98%) ⬆️
...urces/PostgresNIO/New/Messages/ErrorResponse.swift 32.30% <0.00%> (+3.07%) ⬆️
... and 22 more

Copy link
Member

@gwynne gwynne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you 😭❤️

@fabianfett fabianfett merged commit cedb5ad into vapor:main Feb 26, 2022
@fabianfett fabianfett deleted the ff-fewer-force-unwraps branch February 26, 2022 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants