Skip to content

Commit

Permalink
Rust APIのunsafe_codeallowにする (#773)
Browse files Browse the repository at this point in the history
voicevox_coreの`unsafe_code`を`allow`にする
  • Loading branch information
qryxip authored Apr 15, 2024
1 parent 1788d60 commit 7afc276
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
5 changes: 4 additions & 1 deletion crates/voicevox_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,8 @@ humansize.workspace = true
windows = { workspace = true, features = ["Win32_Foundation", "Win32_Graphics_Dxgi"] }

[lints.rust]
unsafe_code = "deny" # FIXME: あまり意味が無くなっているため潔く`allow`にする。あるいはunsafeを撲滅する
# FIXME: `unsafe impl Send`のもあるが、以下2つのマージにより消える予定
# * https://github.com/VOICEVOX/voicevox_core/pull/725
# * https://github.com/VOICEVOX/voicevox_core/pull/772
unsafe_code = "allow" # WindowsのGPU情報表示に、Win32を利用
rust_2018_idioms = "warn"
1 change: 0 additions & 1 deletion crates/voicevox_core/src/engine/open_jtalk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ pub(crate) mod blocking {
}

// FIXME: open_jtalk-rs側で宣言する
#[allow(unsafe_code)]
unsafe impl Send for Resources {}
}

Expand Down
1 change: 0 additions & 1 deletion crates/voicevox_core/src/infer/runtimes/onnxruntime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,5 @@ mod assert_send {
}

// SAFETY: `Session` is probably "send"able.
#[allow(unsafe_code)]
unsafe impl<T> Send for AssertSend<T> {}
}
1 change: 0 additions & 1 deletion crates/voicevox_core/src/synthesizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,6 @@ pub(crate) mod blocking {
}

fn list_windows_video_cards() -> windows::core::Result<Vec<DXGI_ADAPTER_DESC>> {
#[allow(unsafe_code)]
unsafe {
let factory = CreateDXGIFactory::<IDXGIFactory>()?;
(0..)
Expand Down

0 comments on commit 7afc276

Please sign in to comment.