Code cleanup and formatting for System.Memory src and test#28875
Code cleanup and formatting for System.Memory src and test#28875ahsonkhan merged 14 commits intodotnet:masterfrom
Conversation
…ase characters: s_maxBufferSize
…ase characters: e0
| case 0x5468752c /* 'Thu,' */: dayOfWeek = DayOfWeek.Thursday; break; | ||
| case 0x4672692c /* 'Fri,' */: dayOfWeek = DayOfWeek.Friday; break; | ||
| case 0x5361742c /* 'Sat,' */: dayOfWeek = DayOfWeek.Saturday; break; | ||
| case 0x53756E2c /* 'Sun,' */: |
There was a problem hiding this comment.
I think this change makes the code less readable.
| case 0x4f637420 /* 'Oct ' */ : month = 10; break; | ||
| case 0x4e6f7620 /* 'Nov ' */ : month = 11; break; | ||
| case 0x44656320 /* 'Dec ' */ : month = 12; break; | ||
| case 0x4a616e20 /* 'Jan ' */ : |
While it's great to cleanup code formatting, this type of change is unnecessary risk to the RC milestone. Please hold off on merging this until master becomes 2.2 later this month. |
| internal static class HashHelpers | ||
| { | ||
| public static readonly int RandomSeed = Guid.NewGuid().GetHashCode(); | ||
| public static readonly int s_randomSeed = Guid.NewGuid().GetHashCode(); |
There was a problem hiding this comment.
We don't use the s_ naming for public fields.
There was a problem hiding this comment.
I didn't know that. We should add that as an exception to our coding style guidelines.
| return true; | ||
|
|
||
| return TryParseAsSpecialFloatingPoint<double>(source, double.PositiveInfinity, double.NegativeInfinity, double.NaN, out value, out bytesConsumed); | ||
| return TryParseAsSpecialFloatingPoint(source, double.PositiveInfinity, double.NegativeInfinity, double.NaN, out value, out bytesConsumed); |
There was a problem hiding this comment.
The float version of this method specifies the generic type explicitly - they should stay consistent. (And I'd prefer you keep it explicit. We don't need to jump to accomodate every time the VS IDE whines that the compiler can figure something out. We don't write source code just for the compiler's sake.)
| // The .NET Foundation licenses this file to you under the MIT license. | ||
| // See the LICENSE file in the project root for more information. | ||
|
|
||
| using System.Diagnostics; |
There was a problem hiding this comment.
Personally, I don't think we need go out of our way to remove using System.Diagnostics. Encouraging the use of assertions by removing friction from its use is more valuable than removing every bit of white-font from the IDE.
| } | ||
|
|
||
| var dayAbbrev = DayAbbreviationsLowercase[(int)value.DayOfWeek]; | ||
| var dayAbbrev = s_dayAbbreviationsLowercase[(int)value.DayOfWeek]; |
There was a problem hiding this comment.
var => whatever type this is... same for the other such cases
stephentoub
left a comment
There was a problem hiding this comment.
Other than the remaining feedback, LGTM. Please squash when merging.
|
@ahsonkhan, are you still working on this? |
I will refresh the PR to address the feedback in a couple of days. Thanks for the reminder. |
|
@dotnet-bot test Windows x64 Debug Build |
|
@dotnet-bot test NETFX x86 Release Build |
|
@dotnet-bot test Windows x64 Debug Build |
…refx#28875) * Cleanup code formatting. * IDE0001 C# Name can be simplified. * IDE0013 C# Name can be simplified. * IDE1006 C# Naming rule violation: Missing prefix: 's_' * C# Naming rule violation: Missing prefix: 's_' * Remove unnecessary using statements. * IDE1006 C# Naming rule violation: These words must begin with upper case characters: s_maxBufferSize * Code formatting of test files. * Cleanup use of pragma warning disable directives in tests. * IDE1005 C# Delegate invocation can be simplified. * IDE1006 C# Naming rule violation: These words must begin with upper case characters: e0 * Fix use of RandomSeed and TestEnum values due to variable rename * Address PR feedback Commit migrated from dotnet/corefx@84f5ac7
Each set of changes is a separate commit.
Related PR on the coreclr side: dotnet/coreclr#17451
cc @dotnet/corefxlab-contrib, @stephentoub, @jkotas