Fix IDE0083

This commit is contained in:
RoosterDragon
2023-04-05 19:27:14 +01:00
committed by Pavel Penev
parent bd2b3d9793
commit 164abfdae1
37 changed files with 41 additions and 41 deletions

View File

@@ -510,7 +510,7 @@ namespace OpenRA
public static bool IsTraitEnabled<T>(this T trait)
{
return !(trait is IDisabledTrait disabledTrait) || !disabledTrait.IsTraitDisabled;
return trait is not IDisabledTrait disabledTrait || !disabledTrait.IsTraitDisabled;
}
public static T FirstEnabledTraitOrDefault<T>(this IEnumerable<T> ts)

View File

@@ -309,7 +309,7 @@ namespace OpenRA.FileSystem
if (!installedMods.TryGetValue(parentPath[1..], out var mod))
return null;
if (!(mod.Package is Folder))
if (mod.Package is not Folder)
return null;
path = Path.Combine(mod.Package.Name, filename);

View File

@@ -177,7 +177,7 @@ namespace OpenRA.Graphics
foreach (var e in World.Effects)
{
if (!(e is IEffectAboveShroud ea))
if (e is not IEffectAboveShroud ea)
continue;
foreach (var renderable in ea.RenderAboveShroud(this))
@@ -218,7 +218,7 @@ namespace OpenRA.Graphics
foreach (var e in World.Effects)
{
if (!(e is IEffectAnnotation ea))
if (e is not IEffectAnnotation ea)
continue;
foreach (var renderAnnotation in ea.RenderAnnotation(this))

View File

@@ -87,7 +87,7 @@ namespace OpenRA
var ret = new MiniYaml(Type);
foreach (var o in initDict.Value)
{
if (!(o is ActorInit init) || o is ISuppressInitExport)
if (o is not ActorInit init || o is ISuppressInitExport)
continue;
if (initFilter != null && !initFilter(init))

View File

@@ -481,7 +481,7 @@ namespace OpenRA
innerData.Status = MapStatus.Downloading;
var installLocation = cache.MapLocations.FirstOrDefault(p => p.Value == MapClassification.User);
if (!(installLocation.Key is IReadWritePackage mapInstallPackage))
if (installLocation.Key is not IReadWritePackage mapInstallPackage)
{
Log.Write("debug", "Map install directory not found");
innerData.Status = MapStatus.DownloadError;

View File

@@ -99,7 +99,7 @@ namespace OpenRA.Network
// Generating sync reports is expensive, so only do it if we have
// other players to compare against if a desync did occur
generateSyncReport = !(Connection is ReplayConnection) && LobbyInfo.GlobalSettings.EnableSyncReports;
generateSyncReport = Connection is not ReplayConnection && LobbyInfo.GlobalSettings.EnableSyncReports;
NetFrameNumber = 1;
LocalFrameNumber = 0;

View File

@@ -210,7 +210,7 @@ namespace OpenRA.Primitives
public override bool Equals(object obj)
{
if (!(obj is Color))
if (obj is not Color)
return false;
return this == (Color)obj;

View File

@@ -88,7 +88,7 @@ namespace OpenRA.Primitives
public override bool Equals(object obj)
{
if (!(obj is Rectangle))
if (obj is not Rectangle)
return false;
return this == (Rectangle)obj;

View File

@@ -53,7 +53,7 @@ namespace OpenRA.Primitives
public override bool Equals(object obj)
{
if (!(obj is Size))
if (obj is not Size)
return false;
return this == (Size)obj;

View File

@@ -87,7 +87,7 @@ namespace OpenRA.Scripting
{
foreach (var arg in clrArgs)
{
if (!(arg is LuaValue[] table))
if (arg is not LuaValue[] table)
continue;
foreach (var value in table)

View File

@@ -125,7 +125,7 @@ namespace OpenRA.Scripting
else
{
var elementHasClrValue = kv.Value.TryGetClrValue(innerType, out element);
if (!elementHasClrValue || !(element is LuaValue))
if (!elementHasClrValue || element is not LuaValue)
kv.Value.Dispose();
if (!elementHasClrValue)
throw new LuaException($"Unable to convert table value of type {kv.Value.WrappedClrType()} to type {innerType}");

View File

@@ -97,7 +97,7 @@ namespace OpenRA
public int CompareTo(object obj)
{
if (!(obj is WDist))
if (obj is not WDist)
return 1;
return Length.CompareTo(((WDist)obj).Length);
}

View File

@@ -355,7 +355,7 @@ namespace OpenRA
{
effects.Add(e);
if (!(e is ISpatiallyPartitionable))
if (e is not ISpatiallyPartitionable)
unpartitionedEffects.Add(e);
if (e is ISync se)
@@ -366,7 +366,7 @@ namespace OpenRA
{
effects.Remove(e);
if (!(e is ISpatiallyPartitionable))
if (e is not ISpatiallyPartitionable)
unpartitionedEffects.Remove(e);
if (e is ISync se)