Skip to content

Commit

Permalink
fix: IndexMap::{removeshift_remove} (#846)
Browse files Browse the repository at this point in the history
新しいバージョンのindexmapで`IndexMap::remove`が`#[deprecated]`になるこ
とへの対応。ただしこのPRではindexmapのバージョンはそのままにして、アップ
デートはRenovateに任せる。

`#[deprecated]`対応とは別に、`UserDict::remove_word`の挙動として
`swap_remove`は適切ではないので`shift_remove`の方に統一しておく。
  • Loading branch information
qryxip authored Oct 3, 2024
1 parent 00dd3ea commit 6510a2a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crates/voicevox_core/src/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ impl<R: InferenceRuntime> LoadedModels<R> {
}

fn remove(&mut self, model_id: VoiceModelId) -> Result<()> {
if self.0.remove(&model_id).is_none() {
if self.0.shift_remove(&model_id).is_none() {
return Err(ErrorRepr::ModelNotFound { model_id }.into());
}
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion crates/voicevox_core/src/user_dict/dict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl<A: Async> Inner<A> {
}

fn remove_word(&self, word_uuid: Uuid) -> crate::Result<UserDictWord> {
let Some(word) = self.with_words(|words| words.remove(&word_uuid)) else {
let Some(word) = self.with_words(|words| words.shift_remove(&word_uuid)) else {
return Err(ErrorRepr::WordNotFound(word_uuid).into());
};
Ok(word)
Expand Down

0 comments on commit 6510a2a

Please sign in to comment.