diff --git a/.editorconfig b/.editorconfig index 5fe5e57192..8fcb154361 100644 --- a/.editorconfig +++ b/.editorconfig @@ -153,6 +153,9 @@ dotnet_diagnostic.IDE0020.severity = warning # Collection initialization can be simplified dotnet_diagnostic.IDE0028.severity = warning +# Use coalesce expression (non-nullable types). +dotnet_diagnostic.IDE0029.severity = warning + # Simplify 'default' expression dotnet_diagnostic.IDE0034.severity = warning diff --git a/OpenRA.Mods.Common/Terrain/DefaultTileCache.cs b/OpenRA.Mods.Common/Terrain/DefaultTileCache.cs index 912ef873f7..aae4ea049c 100644 --- a/OpenRA.Mods.Common/Terrain/DefaultTileCache.cs +++ b/OpenRA.Mods.Common/Terrain/DefaultTileCache.cs @@ -94,7 +94,7 @@ namespace OpenRA.Mods.Common.Terrain } var frameCount = terrainInfo.EnableDepth && depthFrames == null ? allFrames.Length / 2 : allFrames.Length; - var indices = templateInfo.Frames != null ? templateInfo.Frames : Exts.MakeArray(t.Value.TilesCount, j => j); + var indices = templateInfo.Frames ?? Exts.MakeArray(t.Value.TilesCount, j => j); var start = indices.Min(); var end = indices.Max(); diff --git a/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs b/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs index 9671db0fe5..562d082fce 100644 --- a/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs +++ b/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs @@ -591,7 +591,7 @@ namespace OpenRA.Mods.Common.Traits { var traits = productionTraits.Where(p => !p.IsTraitDisabled && p.Info.Produces.Contains(Info.Type)); var unpaused = traits.FirstOrDefault(a => !a.IsTraitPaused); - return new TraitPair(self, unpaused != null ? unpaused : traits.FirstOrDefault()); + return new TraitPair(self, unpaused ?? traits.FirstOrDefault()); } // Builds a unit from the actor that holds this queue (1 queue per building)