update code level
This commit is contained in:
@@ -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!(
|
||||
|
||||
Reference in New Issue
Block a user