From fc0bdce151494c10fb4e2b35bb40625d65e8460e Mon Sep 17 00:00:00 2001 From: RoosterDragon Date: Sat, 18 Mar 2023 13:25:08 +0000 Subject: [PATCH] Fix RCS1239 --- .editorconfig | 3 +++ OpenRA.Mods.Common/FileFormats/Blast.cs | 4 +--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.editorconfig b/.editorconfig index c9d9ee5f33..f6f3e2f00e 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1120,3 +1120,6 @@ dotnet_diagnostic.RCS1233.severity = warning # Optimize method call. dotnet_diagnostic.RCS1235.severity = warning + +# Use 'for' statement instead of 'while' statement. +dotnet_diagnostic.RCS1239.severity = warning diff --git a/OpenRA.Mods.Common/FileFormats/Blast.cs b/OpenRA.Mods.Common/FileFormats/Blast.cs index 8c5f8a4766..cf1ee7b168 100644 --- a/OpenRA.Mods.Common/FileFormats/Blast.cs +++ b/OpenRA.Mods.Common/FileFormats/Blast.cs @@ -214,8 +214,7 @@ namespace OpenRA.Mods.Common.FileFormats public int ReadBits(int count) { var ret = 0; - var filled = 0; - while (filled < count) + for (var filled = 0; filled < count; filled++) { if (bitCount == 0) { @@ -226,7 +225,6 @@ namespace OpenRA.Mods.Common.FileFormats ret |= (bitBuffer & 1) << filled; bitBuffer >>= 1; bitCount--; - filled++; } return ret;