From 0c7ace16d1cdb722ffe406d67603f8525ffaa3a9 Mon Sep 17 00:00:00 2001 From: SpaceManiac Date: Thu, 12 Dec 2024 16:25:00 -0800 Subject: [PATCH] Fix most non-obsolete warnings (#5555) --- .../GameObjects/EntitySystems/ContainerSystem.cs | 1 - .../UserInterface/Controls/ColorSelectorSliders.cs | 5 ----- Robust.Server/ServerStatus/StatusHost.Acz.Sources.cs | 4 +--- .../Systems/EntityLookupSystem.ComponentQueries.cs | 6 +++--- Robust.Shared/Toolshed/Commands/Entities/WithCommand.cs | 1 - Robust.UnitTesting/Shared/IoC/IoCManager_Test.cs | 2 ++ .../SerializationTests/CommunitaryLungTest.cs | 8 ++++++++ 7 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Robust.Client/GameObjects/EntitySystems/ContainerSystem.cs b/Robust.Client/GameObjects/EntitySystems/ContainerSystem.cs index 774bf309b7f..f0b8c72cd6a 100644 --- a/Robust.Client/GameObjects/EntitySystems/ContainerSystem.cs +++ b/Robust.Client/GameObjects/EntitySystems/ContainerSystem.cs @@ -5,7 +5,6 @@ using Robust.Shared.GameStates; using Robust.Shared.IoC; using Robust.Shared.Map; -using Robust.Shared.Network; using Robust.Shared.Utility; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; diff --git a/Robust.Client/UserInterface/Controls/ColorSelectorSliders.cs b/Robust.Client/UserInterface/Controls/ColorSelectorSliders.cs index f3df6fd40b4..016b0acf36e 100644 --- a/Robust.Client/UserInterface/Controls/ColorSelectorSliders.cs +++ b/Robust.Client/UserInterface/Controls/ColorSelectorSliders.cs @@ -1,8 +1,5 @@ using System; using System.Collections.Generic; -using Robust.Client.Graphics; -using Robust.Client.ResourceManagement; -using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Maths; @@ -89,8 +86,6 @@ public bool IsAlphaVisible private OptionButton _typeSelector; private List _types = new(); - private static ShaderInstance _shader = default!; - private ColorSelectorStyleBox _topStyle; private ColorSelectorStyleBox _middleStyle; private ColorSelectorStyleBox _bottomStyle; diff --git a/Robust.Server/ServerStatus/StatusHost.Acz.Sources.cs b/Robust.Server/ServerStatus/StatusHost.Acz.Sources.cs index c181159c98b..3ffcb60aba2 100644 --- a/Robust.Server/ServerStatus/StatusHost.Acz.Sources.cs +++ b/Robust.Server/ServerStatus/StatusHost.Acz.Sources.cs @@ -24,7 +24,6 @@ namespace Robust.Server.ServerStatus; internal sealed partial class StatusHost { - private (string binFolder, string[] assemblies)? _aczInfo; private IMagicAczProvider? _magicAczProvider; private IFullHybridAczProvider? _fullHybridAczProvider; @@ -158,8 +157,7 @@ private async Task SourceAczViaMagic(AssetPass pass, IPackageLogger logger { _aczSawmill.Verbose("Using default magic ACZ provider"); // Default provider - var (binFolderPath, assemblyNames) = - _aczInfo ?? ("Content.Client", new[] { "Content.Client", "Content.Shared" }); + var (binFolderPath, assemblyNames) = ("Content.Client", new[] { "Content.Client", "Content.Shared" }); var info = new DefaultMagicAczInfo(binFolderPath, assemblyNames); provider = new DefaultMagicAczProvider(info, _deps); diff --git a/Robust.Shared/GameObjects/Systems/EntityLookupSystem.ComponentQueries.cs b/Robust.Shared/GameObjects/Systems/EntityLookupSystem.ComponentQueries.cs index ddcab6d49b1..3a2c4fa28ae 100644 --- a/Robust.Shared/GameObjects/Systems/EntityLookupSystem.ComponentQueries.cs +++ b/Robust.Shared/GameObjects/Systems/EntityLookupSystem.ComponentQueries.cs @@ -175,7 +175,7 @@ private void AddEntitiesIntersecting( return; - static bool PhysicsQuery(ref QueryState state, in FixtureProxy value) where T : IComponent + static bool PhysicsQuery(ref QueryState state, in FixtureProxy value) { if (!state.Sensors && !value.Fixture.Hard) return true; @@ -196,7 +196,7 @@ static bool PhysicsQuery(ref QueryState state, in FixtureProxy value) wher return true; } - static bool SundriesQuery(ref QueryState state, in EntityUid value) where T : IComponent + static bool SundriesQuery(ref QueryState state, in EntityUid value) { if (!state.Query.TryGetComponent(value, out var comp)) return true; @@ -318,7 +318,7 @@ private bool AnyComponentsIntersecting( return state.Found; - static bool PhysicsQuery(ref AnyQueryState state, in FixtureProxy value) where T : IComponent + static bool PhysicsQuery(ref AnyQueryState state, in FixtureProxy value) { if (value.Entity == state.Ignored) return true; diff --git a/Robust.Shared/Toolshed/Commands/Entities/WithCommand.cs b/Robust.Shared/Toolshed/Commands/Entities/WithCommand.cs index 18dea3417a6..a0feadaaa20 100644 --- a/Robust.Shared/Toolshed/Commands/Entities/WithCommand.cs +++ b/Robust.Shared/Toolshed/Commands/Entities/WithCommand.cs @@ -11,7 +11,6 @@ namespace Robust.Shared.Toolshed.Commands.Entities; internal sealed class WithCommand : ToolshedCommand { [Dependency] private readonly IComponentFactory _componentFactory = default!; - [Dependency] private readonly IPrototypeManager _prototype = default!; [CommandImplementation] public IEnumerable With( diff --git a/Robust.UnitTesting/Shared/IoC/IoCManager_Test.cs b/Robust.UnitTesting/Shared/IoC/IoCManager_Test.cs index 1811962f9c1..f56cce14a64 100644 --- a/Robust.UnitTesting/Shared/IoC/IoCManager_Test.cs +++ b/Robust.UnitTesting/Shared/IoC/IoCManager_Test.cs @@ -243,10 +243,12 @@ public class TestFieldInjectionParent { [Dependency] #pragma warning disable 649 +#pragma warning disable RA0032 private readonly TestFieldInjection myself = default!; [Dependency] public TestFieldInjection myotherself = default!; +#pragma warning restore RA0032 #pragma warning restore 649 public virtual void Test() diff --git a/Robust.UnitTesting/Shared/Serialization/SerializationTests/CommunitaryLungTest.cs b/Robust.UnitTesting/Shared/Serialization/SerializationTests/CommunitaryLungTest.cs index d31a21d5e1f..dfd68cba52b 100644 --- a/Robust.UnitTesting/Shared/Serialization/SerializationTests/CommunitaryLungTest.cs +++ b/Robust.UnitTesting/Shared/Serialization/SerializationTests/CommunitaryLungTest.cs @@ -17,14 +17,18 @@ public void Test() Assert.That(def.Dict == copy.Dict, Is.False); // Sanity check +#pragma warning disable CS1718 // Comparison made to same variable Assert.That(def.Dict == def.Dict, Is.True); +#pragma warning restore CS1718 // Comparison made to same variable Serialization.CopyTo(def, ref copy, notNullableOverride: true); Assert.That(def.Dict == copy.Dict, Is.False); // Sanity check +#pragma warning disable CS1718 // Comparison made to same variable Assert.That(def.Dict == def.Dict, Is.True); +#pragma warning restore CS1718 // Comparison made to same variable } [Test] @@ -38,7 +42,9 @@ public void NullableNonNullTest() Assert.That(copy.Dict, Is.Not.Null); // Sanity check +#pragma warning disable CS1718 // Comparison made to same variable Assert.That(def.Dict == def.Dict, Is.True); +#pragma warning restore CS1718 // Comparison made to same variable Serialization.CopyTo(def, ref copy, notNullableOverride: true); @@ -46,7 +52,9 @@ public void NullableNonNullTest() Assert.That(copy.Dict, Is.Not.Null); // Sanity check +#pragma warning disable CS1718 // Comparison made to same variable Assert.That(def.Dict == def.Dict, Is.True); +#pragma warning restore CS1718 // Comparison made to same variable } [Test]