Fix IDE0120

This commit is contained in:
RoosterDragon
2023-02-19 12:37:03 +00:00
committed by Pavel Penev
parent ede5412526
commit bf960b6eae
4 changed files with 7 additions and 4 deletions

View File

@@ -210,6 +210,9 @@ dotnet_diagnostic.IDE0082.severity = warning
# Remove unnecessary equality operator.
dotnet_diagnostic.IDE0100.severity = warning
# Simplify LINQ expression.
dotnet_diagnostic.IDE0120.severity = warning
# Naming rule violation.
dotnet_diagnostic.IDE1006.severity = warning

View File

@@ -748,7 +748,7 @@ namespace OpenRA
public byte[] SavePreview()
{
var actorTypes = Rules.Actors.Values.Where(a => a.HasTraitInfo<IMapPreviewSignatureInfo>());
var actors = ActorDefinitions.Where(a => actorTypes.Where(ai => ai.Name == a.Value.Value).Any());
var actors = ActorDefinitions.Where(a => actorTypes.Any(ai => ai.Name == a.Value.Value));
var positions = new List<(MPos Position, Color Color)>();
foreach (var actor in actors)
{

View File

@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits.Render
public virtual void RulesetLoaded(Ruleset rules, ActorInfo ai)
{
if (rules.Actors[SystemActors.Player].TraitInfos<ProductionIconOverlayManagerInfo>().Where(piom => piom != this && piom.Type == Type).Any())
if (rules.Actors[SystemActors.Player].TraitInfos<ProductionIconOverlayManagerInfo>().Any(piom => piom != this && piom.Type == Type))
throw new YamlException($"Multiple 'ProductionIconOverlayManager's with type '{Type}' exist.");
}

View File

@@ -27,10 +27,10 @@ namespace OpenRA.Mods.Common.Traits.Render
{
foreach (var type in Types)
{
if (!rules.Actors[SystemActors.Player].TraitInfos<ProductionIconOverlayManagerInfo>().Where(piom => piom.Type == type).Any())
if (!rules.Actors[SystemActors.Player].TraitInfos<ProductionIconOverlayManagerInfo>().Any(piom => piom.Type == type))
throw new YamlException($"A 'ProductionIconOverlayManager' with type '{type}' doesn't exist.");
if (ai.TraitInfos<WithProductionIconOverlayInfo>().Where(wpio => wpio != this && wpio.Types.Contains(type)).Any())
if (ai.TraitInfos<WithProductionIconOverlayInfo>().Any(wpio => wpio != this && wpio.Types.Contains(type)))
throw new YamlException($"Multiple 'WithProductionIconOverlay's with type '{type}' exist on the actor.");
}
}