Skip to content

Updated more code to use C# collection expressions (IDE0300) #7265

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

Merged
merged 1 commit into from
Jul 15, 2024

Conversation

glen-84
Copy link
Collaborator

@glen-84 glen-84 commented Jul 14, 2024

Summary of the changes (Less than 80 chars)

  • Updated more code to use C# collection expressions (IDE0300).

ℹ️ I used the when_types_exactly_match option. The when_types_loosely_match option can change semantics (see here).

When using the latter option:

dotnet_diagnostic.ide0300.severity = warning
dotnet_style_prefer_collection_expression = when_types_loosely_match

There are another 10-20 warnings. You might want to change all or some of these as well, but be careful regarding the change in semantics.

Copy link

codecov bot commented Jul 14, 2024

Codecov Report

Attention: Patch coverage is 99.15966% with 1 line in your changes missing coverage. Please review.

Project coverage is 76.20%. Comparing base (3b950a7) to head (d7ffbc3).

Files Patch % Lines
...ypes/Types/Descriptors/Definitions/BindableList.cs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7265      +/-   ##
==========================================
- Coverage   78.81%   76.20%   -2.62%     
==========================================
  Files        2403     2715     +312     
  Lines      118488   134743   +16255     
==========================================
+ Hits        93390   102684    +9294     
- Misses      25098    32059    +6961     
Flag Coverage Δ
unittests 76.20% <99.15%> (-2.62%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tobias-tengler
Copy link
Collaborator

Can't all of the byte arrays be changed to the new "value"u8 instead?

@glen-84
Copy link
Collaborator Author

glen-84 commented Jul 14, 2024

@tobias-tengler #6591 (comment)

@tobias-tengler
Copy link
Collaborator

Interesting. I wanted to know if the generated code is the same and found out that the UTF-8 string literals automatically add a null termination byte:
CleanShot 2024-07-14 at 19 16 10@2x
I would've thought it to be the same. The more you know :D

@michaelstaib michaelstaib merged commit 8e7efac into main Jul 15, 2024
183 of 192 checks passed
@michaelstaib michaelstaib deleted the gai/IDE0300 branch July 15, 2024 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants