From 45159091e60799e25e681eef2cd1e62429330730 Mon Sep 17 00:00:00 2001 From: Morilli <35152647+Morilli@users.noreply.github.com> Date: Tue, 26 Mar 2024 18:32:32 +0100 Subject: [PATCH] Optimize IsLoaded can we get rid of the other 3 functions maybe? --- src/BizHawk.Client.EmuHawk/tools/ToolManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BizHawk.Client.EmuHawk/tools/ToolManager.cs b/src/BizHawk.Client.EmuHawk/tools/ToolManager.cs index 90257f1b3c..af79645601 100644 --- a/src/BizHawk.Client.EmuHawk/tools/ToolManager.cs +++ b/src/BizHawk.Client.EmuHawk/tools/ToolManager.cs @@ -441,7 +441,7 @@ namespace BizHawk.Client.EmuHawk /// Type of tool to check /// yo why do we have 4 versions of this, each with slightly different behaviour in edge cases --yoshi public bool IsLoaded() where T : IToolForm - => _tools.OfType().FirstOrDefault()?.IsActive is true; + => _tools.Find(static t => t is T)?.IsActive is true; public bool IsLoaded(Type toolType) => _tools.Find(t => t.GetType() == toolType)?.IsActive is true;