diff --git a/.editorconfig b/.editorconfig index d3c69da1dd..36f16df505 100644 --- a/.editorconfig +++ b/.editorconfig @@ -17,3 +17,10 @@ dotnet_code_quality.CA1305.excluded_symbol_names = T:System.Byte|T:System.SByte| dotnet_diagnostic.CA1305.severity = error dotnet_diagnostic.CA2101.severity = suggestion + +# Performance rules +dotnet_code_quality.CA1826.exclude_ordefault_methods = true + +dotnet_diagnostic.CA1805.severity = silent +dotnet_diagnostic.CA1822.severity = silent +dotnet_diagnostic.CA1838.severity = suggestion diff --git a/Common.props b/Common.props index 2e6de05914..c2acdab16f 100644 --- a/Common.props +++ b/Common.props @@ -4,6 +4,7 @@ Recommended Recommended Recommended + Recommended $(MSBuildProjectDirectory)/../../Common.ruleset true true diff --git a/ExternalProjects/BizHawk.SrcGen.ReflectionCache/ReflectionCacheGenerator.cs b/ExternalProjects/BizHawk.SrcGen.ReflectionCache/ReflectionCacheGenerator.cs index 4d01976c53..b1f363e4f3 100644 --- a/ExternalProjects/BizHawk.SrcGen.ReflectionCache/ReflectionCacheGenerator.cs +++ b/ExternalProjects/BizHawk.SrcGen.ReflectionCache/ReflectionCacheGenerator.cs @@ -77,7 +77,7 @@ namespace {nSpace} {{ private const string EMBED_PREFIX = ""{nSpace}.""; - private static Type[]? _types = null; + private static Type[]? _types; private static readonly Assembly Asm = typeof({nSpace}.ReflectionCache).Assembly; diff --git a/References/BizHawk.SrcGen.ReflectionCache.dll b/References/BizHawk.SrcGen.ReflectionCache.dll index 5d35562ca2..6c08fb3ce8 100644 Binary files a/References/BizHawk.SrcGen.ReflectionCache.dll and b/References/BizHawk.SrcGen.ReflectionCache.dll differ diff --git a/src/BizHawk.Client.EmuHawk/config/ControllerConfig.cs b/src/BizHawk.Client.EmuHawk/config/ControllerConfig.cs index 3f64cda681..50641fb9ec 100644 --- a/src/BizHawk.Client.EmuHawk/config/ControllerConfig.cs +++ b/src/BizHawk.Client.EmuHawk/config/ControllerConfig.cs @@ -114,7 +114,7 @@ namespace BizHawk.Client.EmuHawk // check to make sure that the settings object has all of the appropriate bool buttons foreach (var button in controllerButtons) { - if (!settings.Keys.Contains(button)) + if (!settings.ContainsKey(button)) { settings[button] = defaultValue; } diff --git a/src/BizHawk.Emulation.Common/SaveController.cs b/src/BizHawk.Emulation.Common/SaveController.cs index ff366e3c34..0c423b3df2 100644 --- a/src/BizHawk.Emulation.Common/SaveController.cs +++ b/src/BizHawk.Emulation.Common/SaveController.cs @@ -72,7 +72,7 @@ namespace BizHawk.Emulation.Common foreach (var k in Definition.Axes.Keys) { - if (_buttons.Keys.Contains(k)) + if (_buttons.ContainsKey(k)) { throw new Exception("name collision between bool and float lists!"); }