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

Remove useless use of Option around HeaderMap #1051

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

paolobarbolini
Copy link
Contributor

Calling HeaderMap::new doesn't allocate, but instead creates an empty hashmap.

Considering that code already has to check whether there really were any headers inside of the HeaderMap when the variant is Some, the Option around it didn't make sense.

@caspervonb caspervonb self-requested a review July 22, 2023 20:32
@caspervonb
Copy link
Collaborator

Considering that code already has to check whether there really were any headers inside of the HeaderMap when the variant is Some, the Option around it didn't make sense.

Just a bit of trivia as to why, before we used to send HMSG if headers were Some, even if they were empty.

@caspervonb
Copy link
Collaborator

caspervonb commented Jul 27, 2023

Boils down to this I think, Option signals semantics. Is an empty header map lighter than an empty header map?

This conflicts with #1003 pretty heavily so, may merge but not before that is merged.

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.

2 participants