update code level

This commit is contained in:
lychang
2026-03-28 12:36:26 +08:00
parent 7a68eb959a
commit 675a402848
12 changed files with 372 additions and 386 deletions

View File

@@ -123,7 +123,7 @@ impl AlbumsCache {
}
pub fn update(&mut self, albums: Vec<AlbumInfo>) {
self.albums = albums.clone();
self.albums = albums; // 不再克隆整个向量,而是移动所有权
self.last_updated = chrono::Utc::now();
// 构建搜索索引
@@ -138,15 +138,15 @@ impl AlbumsCache {
self.search_index
.entry(word.to_string())
.or_insert_with(Vec::new)
.push(album.clone());
.push(album.clone()); // 这里仍需要克隆单个元素
}
}
// 为完整标题创建索引
self.search_index
.entry(title_lower.clone())
.entry(title_lower)
.or_insert_with(Vec::new)
.push(album.clone());
.push(album.clone()); // 这里仍需要克隆单个元素
}
info!(