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

Use new language features #445

Merged

Conversation

martincostello
Copy link
Member

@martincostello martincostello commented May 14, 2022

Minor refactoring to use various newer C# language features.

Also applies a few minor optimisations.

Use `is null` and `is not null`.
Use expression-bodied method for minor refactor.
- Reduce line width.
- Remove redundant namespace.
Use Uri constants instead of literals.
Do not try to template the string if it's empty.
Allocate collections with the appropriate capacity when the target size is known.
Add a test case for HTTP status codes that aren't defined in HttpStatusCode.
@martincostello martincostello added the enhancement A change that enhances existing functionality or documentation. label May 14, 2022
@martincostello martincostello added this to the v3.1.2 milestone May 14, 2022
@codecov-commenter
Copy link

codecov-commenter commented May 14, 2022

Codecov Report

Merging #445 (0cbb0b0) into main (3423823) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main      #445   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           16        16           
  Lines          699       704    +5     
=========================================
+ Hits           699       704    +5     
Flag Coverage Δ
linux 100.00% <100.00%> (ø)
macos 100.00% <100.00%> (ø)
windows 100.00% <100.00%> (ø)

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

Impacted Files Coverage Δ
src/HttpClientInterception/BundleExtensions.cs 100.00% <100.00%> (ø)
...pClientInterception/Bundles/BundleItemConverter.cs 100.00% <100.00%> (ø)
src/HttpClientInterception/DelegateHelpers.cs 100.00% <100.00%> (ø)
...ClientInterception/HttpClientInterceptorOptions.cs 100.00% <100.00%> (ø)
...rception/HttpClientInterceptorOptionsExtensions.cs 100.00% <100.00%> (ø)
...ientInterception/HttpRequestInterceptionBuilder.cs 100.00% <100.00%> (ø)
...eption/HttpRequestInterceptionBuilderExtensions.cs 100.00% <100.00%> (ø)
...ientInterception/InterceptingHttpMessageHandler.cs 100.00% <100.00%> (ø)
...ClientInterception/Matching/RegistrationMatcher.cs 100.00% <100.00%> (ø)
...HttpClientInterception/SystemTextJsonExtensions.cs 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3423823...0cbb0b0. Read the comment docs.

@martincostello martincostello marked this pull request as ready for review May 14, 2022 15:10
@martincostello martincostello requested a review from a team as a code owner May 14, 2022 15:10
@martincostello martincostello enabled auto-merge May 14, 2022 15:10
@martincostello martincostello merged commit de1e9c6 into justeattakeaway:main May 14, 2022
@martincostello martincostello deleted the use-new-language-features branch May 14, 2022 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A change that enhances existing functionality or documentation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants