Contribute to StyleCop SA1002 (semicolon spacing)
authorStephen Toub <stoub@microsoft.com>
Thu, 22 Aug 2019 17:10:47 +0000 (13:10 -0400)
committerStephen Toub <stoub@microsoft.com>
Mon, 26 Aug 2019 02:11:44 +0000 (22:11 -0400)
However, I'm not enabling the rule permanently, as it disagrees with VS IDE0055 about the spacing around semicolons at the end of empty while and for loops.

Because this also impacts `for (;;)` loops, I also searched and replaced those with `while (true)`, to standardize on that across the codebase.

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
Commit migrated from https://github.com/dotnet/coreclr/commit/63c09bbf88cc6524ea8478fdea430ba45275a933

src/libraries/System.Private.CoreLib/src/System/Buffers/Text/Utf8Parser/Utf8Parser.Integer.Signed.N.cs
src/libraries/System.Private.CoreLib/src/System/Buffers/Text/Utf8Parser/Utf8Parser.Integer.Unsigned.N.cs
src/libraries/System.Private.CoreLib/src/System/Convert.cs
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/ActivityTracker.cs
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventProvider.cs
src/libraries/System.Private.CoreLib/src/System/Number.Formatting.cs
src/libraries/System.Private.CoreLib/src/System/SpanHelpers.Byte.cs
src/libraries/System.Private.CoreLib/src/System/SpanHelpers.T.cs

index 2179867..10f33f6 100644 (file)
@@ -41,7 +41,7 @@ namespace System.Buffers.Text
                 goto FalseExit;
             answer = c - '0';
 
-            for (; ; )
+            while (true)
             {
                 index++;
                 if ((uint)index >= (uint)source.Length)
@@ -133,7 +133,7 @@ namespace System.Buffers.Text
                 goto FalseExit;
             answer = c - '0';
 
-            for (; ; )
+            while (true)
             {
                 index++;
                 if ((uint)index >= (uint)source.Length)
@@ -225,7 +225,7 @@ namespace System.Buffers.Text
                 goto FalseExit;
             answer = c - '0';
 
-            for (; ; )
+            while (true)
             {
                 index++;
                 if ((uint)index >= (uint)source.Length)
@@ -320,7 +320,7 @@ namespace System.Buffers.Text
                 goto FalseExit;
             answer = c - '0';
 
-            for (; ; )
+            while (true)
             {
                 index++;
                 if ((uint)index >= (uint)source.Length)
index a52d231..6fa38eb 100644 (file)
@@ -35,7 +35,7 @@ namespace System.Buffers.Text
                 goto FalseExit;
             answer = c - '0';
 
-            for (; ; )
+            while (true)
             {
                 index++;
                 if ((uint)index >= (uint)source.Length)
@@ -116,7 +116,7 @@ namespace System.Buffers.Text
                 goto FalseExit;
             answer = c - '0';
 
-            for (; ; )
+            while (true)
             {
                 index++;
                 if ((uint)index >= (uint)source.Length)
@@ -197,7 +197,7 @@ namespace System.Buffers.Text
                 goto FalseExit;
             answer = c - '0';
 
-            for (; ; )
+            while (true)
             {
                 index++;
                 if ((uint)index >= (uint)source.Length)
@@ -278,7 +278,7 @@ namespace System.Buffers.Text
                 goto FalseExit;
             answer = c - '0';
 
-            for (; ; )
+            while (true)
             {
                 index++;
                 if ((uint)index >= (uint)source.Length)
index 990f3b2..205694a 100644 (file)
@@ -2656,7 +2656,7 @@ namespace System
                     // If we got here, the very first character not consumed was a whitespace. We can skip past any consecutive whitespace, then continue decoding.
 
                     int indexOfFirstNonSpace = 1;
-                    for (; ; )
+                    while (true)
                     {
                         if (indexOfFirstNonSpace == chars.Length)
                             break;
index 70c3dcd..0f47691 100644 (file)
@@ -150,7 +150,7 @@ namespace System.Diagnostics.Tracing
                 log.DebugFacilityMessage("OnStopEnterActivityState", ActivityInfo.LiveActivities(m_current.Value));
             }
 
-            for (; ; ) // This is a retry loop.
+            while (true) // This is a retry loop.
             {
                 ActivityInfo? currentActivity = m_current.Value;
                 ActivityInfo? newCurrentActivity = null;               // if we have seen any live activities (orphans), at he first one we have seen.
index 2167758..0a5e1ca 100644 (file)
@@ -459,7 +459,7 @@ namespace System.Diagnostics.Tracing
 #if (PLATFORM_WINDOWS && (ES_SESSION_INFO || !ES_BUILD_STANDALONE))
             int buffSize = 256;     // An initial guess that probably works most of the time.
             byte* buffer;
-            for (; ; )
+            while (true)
             {
                 byte* space = stackalloc byte[buffSize];
                 buffer = space;
index 131e3a0..e086734 100644 (file)
@@ -2455,7 +2455,7 @@ namespace System
             fixed (char* pFormat = &MemoryMarshal.GetReference(format))
             {
                 src = 0;
-                for (; ; )
+                while (true)
                 {
                     if (src >= format.Length)
                     {
index d553d97..01f53a8 100644 (file)
@@ -438,7 +438,7 @@ namespace System
             int valueTailLength = valueLength - 1;
 
             int offset = 0;
-            for (; ; )
+            while (true)
             {
                 Debug.Assert(0 <= offset && offset <= searchSpaceLength); // Ensures no deceptive underflows in the computation of "remainingSearchSpaceLength".
                 int remainingSearchSpaceLength = searchSpaceLength - offset - valueTailLength;
index 6e14b92..dccc8fb 100644 (file)
@@ -27,7 +27,7 @@ namespace System
             int valueTailLength = valueLength - 1;
 
             int index = 0;
-            for (; ; )
+            while (true)
             {
                 Debug.Assert(0 <= index && index <= searchSpaceLength); // Ensures no deceptive underflows in the computation of "remainingSearchSpaceLength".
                 int remainingSearchSpaceLength = searchSpaceLength - index - valueTailLength;
@@ -470,7 +470,7 @@ namespace System
             int valueTailLength = valueLength - 1;
 
             int index = 0;
-            for (; ; )
+            while (true)
             {
                 Debug.Assert(0 <= index && index <= searchSpaceLength); // Ensures no deceptive underflows in the computation of "remainingSearchSpaceLength".
                 int remainingSearchSpaceLength = searchSpaceLength - index - valueTailLength;