From ce39e97b8600d3d770744ed48872c0f82fb94c16 Mon Sep 17 00:00:00 2001 From: RoosterDragon Date: Sat, 18 Mar 2023 12:48:59 +0000 Subject: [PATCH] Fix RCS1080 --- .editorconfig | 3 +++ OpenRA.Game/UtilityCommands/ExtractChromeStrings.cs | 2 +- .../Rules/20230801/RemoveValidRelationsFromCapturable.cs | 3 +-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.editorconfig b/.editorconfig index 72e278d7a8..361f6249e2 100644 --- a/.editorconfig +++ b/.editorconfig @@ -995,6 +995,9 @@ dotnet_diagnostic.RCS1072.severity = warning # Remove redundant constructor. dotnet_diagnostic.RCS1074.severity = warning +# Use 'Count' property instead of 'Any' method. +dotnet_diagnostic.RCS1080.severity = warning + # Remove empty region. dotnet_diagnostic.RCS1091.severity = warning diff --git a/OpenRA.Game/UtilityCommands/ExtractChromeStrings.cs b/OpenRA.Game/UtilityCommands/ExtractChromeStrings.cs index d23bee58a9..cd51bdacca 100644 --- a/OpenRA.Game/UtilityCommands/ExtractChromeStrings.cs +++ b/OpenRA.Game/UtilityCommands/ExtractChromeStrings.cs @@ -38,7 +38,7 @@ namespace OpenRA.UtilityCommands .ToDictionary( t => t.Name[..^6], t => t.GetFields().Where(f => f.HasAttribute()).Select(f => f.Name).ToArray()) - .Where(t => t.Value.Any()) + .Where(t => t.Value.Length > 0) .ToDictionary(t => t.Key, t => t.Value); var chromeLayouts = modData.Manifest.ChromeLayout.GroupBy(c => c.Split('/')[0].Split('|')[0], c => c); diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20230801/RemoveValidRelationsFromCapturable.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20230801/RemoveValidRelationsFromCapturable.cs index 6434cd3a7c..104a791925 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20230801/RemoveValidRelationsFromCapturable.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20230801/RemoveValidRelationsFromCapturable.cs @@ -10,7 +10,6 @@ #endregion using System.Collections.Generic; -using System.Linq; namespace OpenRA.Mods.Common.UpdateRules.Rules { @@ -24,7 +23,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules public override IEnumerable AfterUpdate(ModData modData) { - if (locations.Any()) + if (locations.Count > 0) yield return Description + "\n" + "ValidRelations have been removed from:\n" + UpdateUtils.FormatMessageList(locations);