Fix IDE0083
This commit is contained in:
committed by
Pavel Penev
parent
bd2b3d9793
commit
164abfdae1
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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}");
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user