diff --git a/crates/voicevox_core/src/engine/acoustic_feature_extractor.rs b/crates/voicevox_core/src/engine/acoustic_feature_extractor.rs index 87b634e11..8dac7c06a 100644 --- a/crates/voicevox_core/src/engine/acoustic_feature_extractor.rs +++ b/crates/voicevox_core/src/engine/acoustic_feature_extractor.rs @@ -63,10 +63,6 @@ static PHONEME_MAP: LazyLock> = LazyLock::new(|| { #[derive(Debug, Clone, PartialEq, new, Default, Getters)] pub(crate) struct OjtPhoneme { phoneme: String, - // FIXME: derive-getters(多分)が警告を覆い隠しているが、以下の二つは使っていないはず。`Debug`用 - // に持つというのはありかもしれないが… - start: f32, - end: f32, } impl OjtPhoneme { @@ -114,8 +110,8 @@ mod tests { fn base_hello_hiho() -> Vec { STR_HELLO_HIHO .split_whitespace() - .enumerate() - .map(|(i, s)| OjtPhoneme::new(s.into(), i as f32, (i + 1) as f32)) + .map(ToOwned::to_owned) + .map(OjtPhoneme::new) .collect() } @@ -155,9 +151,9 @@ mod tests { } #[rstest] - #[case(ojt_hello_hiho(), 9, OjtPhoneme::new("a".into(), 9., 10.), true)] - #[case(ojt_hello_hiho(), 9, OjtPhoneme::new("k".into(), 9., 10.), false)] - #[case(ojt_hello_hiho(), 9, OjtPhoneme::new("a".into(), 10., 11.), false)] + #[case(ojt_hello_hiho(), 9, OjtPhoneme::new("a".into()), true)] + #[case(ojt_hello_hiho(), 9, OjtPhoneme::new("k".into()), false)] + #[case(ojt_hello_hiho(), 9, OjtPhoneme::new("a".into()), false)] fn test_ojt_phoneme_equality( #[case] ojt_phonemes: Vec, #[case] index: usize, diff --git a/crates/voicevox_core/src/synthesizer.rs b/crates/voicevox_core/src/synthesizer.rs index 045a2d9ea..ee960cd1a 100644 --- a/crates/voicevox_core/src/synthesizer.rs +++ b/crates/voicevox_core/src/synthesizer.rs @@ -1079,8 +1079,9 @@ pub(crate) mod blocking { OjtPhoneme::convert( phoneme_str_list .iter() - .enumerate() - .map(|(i, s)| OjtPhoneme::new(s.as_ref().to_string(), i as f32, i as f32 + 1.)) + .map(AsRef::as_ref) + .map(ToOwned::to_owned) + .map(OjtPhoneme::new) .collect::>() .as_slice(), )