Skip to content

Commit

Permalink
Code: cargo clippy、cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
sevenc-nanashi committed Sep 10, 2023
1 parent a8627c7 commit a2e1586
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 9 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion engine_manifest.json
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/routes/mod.rs
Original file line number Diff line number Diff line change
@@ -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;
6 changes: 3 additions & 3 deletions src/voicevox/open_jtalk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
Expand Down
4 changes: 2 additions & 2 deletions src/voicevox/user_dict/dict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
Expand All @@ -71,7 +71,7 @@ impl UserDict {
/// ユーザー辞書から単語を削除する。
pub fn remove_word(&mut self, word_uuid: Uuid) -> Result<UserDictWord> {
let Some(word) = self.words.remove(&word_uuid) else {
return Err(Error::UnknownWord(word_uuid).into());
return Err(Error::UnknownWord(word_uuid));
};
Ok(word)
}
Expand Down
4 changes: 3 additions & 1 deletion src/voicevox/user_dict/word.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ impl UserDictWord {
priority: u32,
) -> Result<Self> {
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 =
Expand Down

0 comments on commit a2e1586

Please sign in to comment.