rust-toolchain.toml pins to stable 1.94.1 so contributors and CI runners share the exact rustc / rustfmt / clippy versions. Without the pin, every machine surfaces a different lint set depending on its local install — six pre-existing lints showed up on 1.94.1 that 1.93-era HANDOVER reported clean. Clippy fixes (all pre-existing, not introduced by feature work): - crates/storage/src/database.rs: std::iter::repeat().take() -> repeat_n() - crates/llm/src/lib.rs (docs): "+ frontends" was parsed as a markdown bullet continuation by rustdoc, breaking doc-lazy-continuation. Reworded to "and". - crates/llm/src/lib.rs (loop): while-let-on-iterator -> for-loop. - src-tauri/src/commands/security.rs: .iter().any(|a| *a == x) -> .contains(&x). - src-tauri/src/lib.rs: io::Error::new(Other, e) -> io::Error::other(e). - src-tauri/src/tauri_app_data_migration.rs: drop function-tail `return`s inside cfg blocks; each platform's block now ends with a tail expression. cargo fmt sweep across the workspace. Mechanical layout-only changes; no semantics affected. Workspace gates after this commit: - cargo fmt --check: clean - cargo clippy --workspace --all-targets -- -D warnings: clean - cargo test --workspace: 405/0 (will become 409/0 with Phase A.1+A.2)
20 lines
643 B
Rust
20 lines
643 B
Rust
use std::path::Path;
|
|
|
|
use lumotia_core::error::Result;
|
|
use lumotia_core::types::AudioSamples;
|
|
|
|
use crate::decode::decode_audio_file;
|
|
use crate::resample::resample_to_16khz;
|
|
|
|
/// Decode and resample an audio file on a blocking thread.
|
|
/// Returns 16kHz mono AudioSamples ready for transcription.
|
|
pub async fn decode_and_resample(path: &Path) -> Result<AudioSamples> {
|
|
let path = path.to_path_buf();
|
|
tokio::task::spawn_blocking(move || {
|
|
let audio = decode_audio_file(&path)?;
|
|
resample_to_16khz(&audio)
|
|
})
|
|
.await
|
|
.map_err(|e| lumotia_core::error::Error::AudioDecodeFailed(format!("Task join error: {e}")))?
|
|
}
|