From a2e1586bfa07cc1f758a5862fe9306addb2313af Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Sun, 10 Sep 2023 20:30:51 +0900 Subject: [PATCH] =?UTF-8?q?Code:=20cargo=20clippy=E3=80=81cargo=20fmt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/check.yml | 12 +++++++++++- engine_manifest.json | 2 +- src/routes/mod.rs | 2 +- src/voicevox/open_jtalk.rs | 6 +++--- src/voicevox/user_dict/dict.rs | 4 ++-- src/voicevox/user_dict/word.rs | 4 +++- 6 files changed, 21 insertions(+), 9 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 3036d77..159b93b 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -12,9 +12,19 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Rust uses: dtolnay/rust-toolchain@master + - name: Cache target directory + uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin + ~/.cargo/registry + target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo- - name: Run cargo clippy run: cargo clippy --all-targets --all-features -- -D warnings - name: Run cargo fmt diff --git a/engine_manifest.json b/engine_manifest.json index c3430fc..e7eb436 100644 --- a/engine_manifest.json +++ b/engine_manifest.json @@ -1,7 +1,7 @@ { "name": "AIVoice to Voicevox bridge", "uuid": "14f4bd0b-99ac-48cc-8171-d93439f16b33", - "command": "run", + "command": "aivoice-vox", "port": 50201, "supported_features": { "adjust_mora_pitch": false, diff --git a/src/routes/mod.rs b/src/routes/mod.rs index 34ad550..6cd4d18 100644 --- a/src/routes/mod.rs +++ b/src/routes/mod.rs @@ -1,5 +1,5 @@ pub mod audio_query; pub mod info; pub mod speakers; -pub mod user_dict; pub mod synthesis; +pub mod user_dict; diff --git a/src/voicevox/open_jtalk.rs b/src/voicevox/open_jtalk.rs index 56d099f..55ac9aa 100644 --- a/src/voicevox/open_jtalk.rs +++ b/src/voicevox/open_jtalk.rs @@ -102,9 +102,9 @@ impl OpenJtalk { let result = mecab.load_with_userdic(Path::new(dict_dir), Some(Path::new(&temp_dict_path))); if !result { - return Err( - OpenJtalkError::UseUserDict("辞書のコンパイルに失敗しました".to_string()), - ); + return Err(OpenJtalkError::UseUserDict( + "辞書のコンパイルに失敗しました".to_string(), + )); } Ok(()) diff --git a/src/voicevox/user_dict/dict.rs b/src/voicevox/user_dict/dict.rs index f15afe4..70ddf53 100644 --- a/src/voicevox/user_dict/dict.rs +++ b/src/voicevox/user_dict/dict.rs @@ -62,7 +62,7 @@ impl UserDict { /// ユーザー辞書の単語を変更する。 pub fn update_word(&mut self, word_uuid: Uuid, new_word: UserDictWord) -> Result<()> { if !self.words.contains_key(&word_uuid) { - return Err(Error::UnknownWord(word_uuid).into()); + return Err(Error::UnknownWord(word_uuid)); } self.words.insert(word_uuid, new_word); Ok(()) @@ -71,7 +71,7 @@ impl UserDict { /// ユーザー辞書から単語を削除する。 pub fn remove_word(&mut self, word_uuid: Uuid) -> Result { let Some(word) = self.words.remove(&word_uuid) else { - return Err(Error::UnknownWord(word_uuid).into()); + return Err(Error::UnknownWord(word_uuid)); }; Ok(word) } diff --git a/src/voicevox/user_dict/word.rs b/src/voicevox/user_dict/word.rs index e428e6b..8ea8187 100644 --- a/src/voicevox/user_dict/word.rs +++ b/src/voicevox/user_dict/word.rs @@ -101,7 +101,9 @@ impl UserDictWord { priority: u32, ) -> Result { if MIN_PRIORITY > priority || priority > MAX_PRIORITY { - return Err(Error::InvalidWord(InvalidWordError::InvalidPriority(priority)).into()); + return Err(Error::InvalidWord(InvalidWordError::InvalidPriority( + priority, + ))); } validate_pronunciation(&pronunciation).map_err(Error::InvalidWord)?; let mora_count =