Skip to content

Commit 6cf7512

Browse files
authored
fix(cache): switch to sort_by_key for LRU ordering (#131)
Clippy 1.95 flags the explicit `sort_by` closure as unnecessary_sort_by when the comparator is a plain Ord on a single key. Using sort_by_key is shorter and lets the compiler avoid the extra closure indirection.
1 parent a9436d4 commit 6cf7512

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src-tauri/src/cache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ fn get_cached_files_by_age_internal() -> Result<Vec<CacheEntry>, String> {
128128
}
129129

130130
// Sort by modification time (oldest first for LRU eviction)
131-
files.sort_by(|a, b| a.modified.cmp(&b.modified));
131+
files.sort_by_key(|a| a.modified);
132132

133133
Ok(files)
134134
}

0 commit comments

Comments
 (0)