Minor warnings/lints

This commit is contained in:
Asriel Camora
2025-08-18 23:56:49 -07:00
parent d10332fb9d
commit 14b5bd66c0
6 changed files with 17 additions and 6 deletions
+1 -1
View File
@@ -356,7 +356,7 @@ internal static class ImGuiUtils
public SearchableComboData(IEnumerable<T> items, T selectedItem, Func<T, string> getString) public SearchableComboData(IEnumerable<T> items, T selectedItem, Func<T, string> getString)
{ {
this.items = items.ToImmutableArray(); this.items = [.. items];
filteredItems = [selectedItem]; filteredItems = [selectedItem];
this.selectedItem = selectedItem; this.selectedItem = selectedItem;
this.getString = getString; this.getString = getString;
+1 -1
View File
@@ -19,7 +19,7 @@ public sealed class MacroClipboard : Window, IDisposable
public MacroClipboard(IEnumerable<string> macros) : base("Macro Clipboard", WindowFlags) public MacroClipboard(IEnumerable<string> macros) : base("Macro Clipboard", WindowFlags)
{ {
Macros = new(macros); Macros = [.. macros];
IsOpen = true; IsOpen = true;
AllowPinning = false; AllowPinning = false;
+11 -1
View File
@@ -719,9 +719,19 @@ public sealed class MacroEditor : Window, IDisposable
public bool Equals(RecipeWrapper other) => public bool Equals(RecipeWrapper other) =>
Recipe.RowId == other.Recipe.RowId; Recipe.RowId == other.Recipe.RowId;
public override bool Equals(object? obj)
{
return obj is RecipeWrapper other && Equals(other);
}
public override int GetHashCode()
{
return unchecked((int)Recipe.RowId);
}
} }
private readonly List<RecipeWrapper> searchableRecipes = LuminaSheets.RecipeSheet.Where(r => r.RecipeLevelTable.RowId != 0 && r.ItemResult.RowId != 0).Select(r => new RecipeWrapper(r)).ToList(); private readonly List<RecipeWrapper> searchableRecipes = [.. LuminaSheets.RecipeSheet.Where(r => r.RecipeLevelTable.RowId != 0 && r.ItemResult.RowId != 0).Select(r => new RecipeWrapper(r))];
private bool DrawRecipeParams() private bool DrawRecipeParams()
{ {
+1 -1
View File
@@ -343,7 +343,7 @@ public sealed class MacroList : Window, IDisposable
{ {
if (string.IsNullOrWhiteSpace(searchText)) if (string.IsNullOrWhiteSpace(searchText))
{ {
sortedMacros = new(Macros); sortedMacros = [.. Macros];
isUnsorted = true; isUnsorted = true;
return; return;
} }
+1 -1
View File
@@ -1191,7 +1191,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable
config = config.FilterSpecialistActions(); config = config.FilterSpecialistActions();
var mctsConfig = new MCTSConfig(config); var mctsConfig = new MCTSConfig(config);
var simulator = new SimulatorNoRandom(); var simulator = new SimulatorNoRandom();
List<Macro> macros = new(Service.Configuration.Macros); List<Macro> macros = [.. Service.Configuration.Macros];
token.ThrowIfCancellationRequested(); token.ThrowIfCancellationRequested();
+2 -1
View File
@@ -77,6 +77,7 @@ public sealed class Settings : Window, IDisposable
{ {
ImGui.SetNextItemWidth(OptionWidth); ImGui.SetNextItemWidth(OptionWidth);
var text = value.ToString(); var text = value.ToString();
ArgumentNullException.ThrowIfNull(text, nameof(value));
if (ImGui.InputText(label, ref text, 8, ImGuiInputTextFlags.AutoSelectAll | ImGuiInputTextFlags.CharsDecimal)) if (ImGui.InputText(label, ref text, 8, ImGuiInputTextFlags.AutoSelectAll | ImGuiInputTextFlags.CharsDecimal))
{ {
if (T.TryParse(text, null, out var newValue)) if (T.TryParse(text, null, out var newValue))
@@ -791,7 +792,7 @@ public sealed class Settings : Window, IDisposable
isDirty = false; isDirty = false;
var recipeData = Service.Plugin.GetDefaultStats().Recipe; var recipeData = Service.Plugin.GetDefaultStats().Recipe;
HashSet<ActionType> pool = new(actionPool); HashSet<ActionType> pool = [.. actionPool];
var imageSize = ImGui.GetFrameHeight() * 2; var imageSize = ImGui.GetFrameHeight() * 2;
var spacing = ImGui.GetStyle().ItemSpacing.Y; var spacing = ImGui.GetStyle().ItemSpacing.Y;