From 43d3963e3dd09b67324b45f51e46c92e2570ecdb Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Mon, 5 Jan 2026 09:45:32 +0800 Subject: [PATCH] Make SearchResult readonly and init HighlightData to empty list Changed SearchResult to a readonly record struct for better immutability and performance. Updated HighlightData to initialize as an empty list using a collection expression instead of null. Retained the default constructor with a clarifying comment. --- Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchResult.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchResult.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchResult.cs index 148072931..e2ff216ca 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchResult.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchResult.cs @@ -2,8 +2,9 @@ namespace Flow.Launcher.Plugin.Explorer.Search { - public record struct SearchResult + public readonly record struct SearchResult { + // Constructor is necesssary for record struct public SearchResult() { } @@ -13,6 +14,6 @@ namespace Flow.Launcher.Plugin.Explorer.Search public int Score { get; init; } public bool WindowsIndexed { get; init; } - public List HighlightData { get; init; } = null; + public List HighlightData { get; init; } = []; } }