This repository was archived by the owner on Jul 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 134
Various improvements #220
Merged
Merged
Various improvements #220
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
iamcarbon
commented
Apr 4, 2020
- Update langversion to 8
- Enable #nullable annotations
- Use HashCode.Combine
- Simplify a switch statement with a switch expression
- Simplify equality
- Use shared HeaderNames
- Prefer is null to == null
- Remove unused using statement
- Seal classes
Contributor
Author
|
@damianh Ready for review |
bartelink
reviewed
Apr 5, 2020
src/ProxyKit/UpstreamHost.cs
Outdated
| private int DefaultPort(string scheme) | ||
| { | ||
| switch (scheme.ToLower()) | ||
| return scheme.ToLowerInvariant() switch |
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be using String.Equals(...,..., StringComparison.OrdinalIgnoreCase) rather than triggering copying/allocation for no reward
a small local function helper "SchemeIs(value : string)` should leave it pretty comprehensible as an if/else chain
Contributor
Author
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even better, we can rely on this being lowercase by normalizing the scheme during construction. Uri().Scheme already normalizes for us.
Collaborator
|
Thanks for PR. Will get to look at this in next week or so. IRL so busy atm. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.