Matrix commited on
Commit
b0c3f88
·
1 Parent(s): 3569cbd

fix: clippy warnings

Browse files
Files changed (3) hide show
  1. src/config.rs +2 -1
  2. src/lesson.rs +1 -2
  3. src/whisper.rs +2 -1
src/config.rs CHANGED
@@ -18,6 +18,7 @@ pub(crate) struct WhisperConfig {
18
  pub(crate) max_prompt_tokens: usize,
19
  }
20
 
 
21
  #[derive(Debug, Deserialize, Clone)]
22
  pub(crate) struct WhisperParams {
23
  pub(crate) n_threads: Option<usize>,
@@ -36,7 +37,7 @@ pub(crate) struct WhisperParams {
36
  pub(crate) language: Option<String>,
37
  }
38
 
39
- const NONE: [c_int; 0] = [];
40
 
41
  impl WhisperParams {
42
  pub(crate) fn to_full_params<'a, 'b>(&'a self, _tokens: &'b [c_int]) -> FullParams<'a, 'b> {
 
18
  pub(crate) max_prompt_tokens: usize,
19
  }
20
 
21
+ #[allow(dead_code)]
22
  #[derive(Debug, Deserialize, Clone)]
23
  pub(crate) struct WhisperParams {
24
  pub(crate) n_threads: Option<usize>,
 
37
  pub(crate) language: Option<String>,
38
  }
39
 
40
+ const _NONE: [c_int; 0] = [];
41
 
42
  impl WhisperParams {
43
  pub(crate) fn to_full_params<'a, 'b>(&'a self, _tokens: &'b [c_int]) -> FullParams<'a, 'b> {
src/lesson.rs CHANGED
@@ -447,8 +447,7 @@ async fn synthesize_speech(
447
  .to_vec();
448
  let parsed: Vec<Viseme> = visemes
449
  .lines()
450
- .filter_map(|line| line.ok())
451
- .filter_map(|line| serde_json::from_str::<Viseme>(&line).ok())
452
  .collect();
453
  Ok((parsed, audio.audio_stream))
454
  }
 
447
  .to_vec();
448
  let parsed: Vec<Viseme> = visemes
449
  .lines()
450
+ .flat_map(|line| Ok::<Viseme, anyhow::Error>(serde_json::from_str::<Viseme>(&line?)?))
 
451
  .collect();
452
  Ok((parsed, audio.audio_stream))
453
  }
src/whisper.rs CHANGED
@@ -54,7 +54,7 @@ impl std::error::Error for Error {
54
  }
55
  }
56
 
57
- fn pcm_i16_to_f32(input: &Vec<u8>) -> Vec<f32> {
58
  let pcm_i16 = input
59
  .chunks_exact(2)
60
  .map(|chunk| {
@@ -157,6 +157,7 @@ impl WhisperHandler {
157
  }
158
  }
159
 
 
160
  struct Detector {
161
  state: WhisperState<'static>,
162
  config: &'static WhisperConfig,
 
54
  }
55
  }
56
 
57
+ fn pcm_i16_to_f32(input: &[u8]) -> Vec<f32> {
58
  let pcm_i16 = input
59
  .chunks_exact(2)
60
  .map(|chunk| {
 
157
  }
158
  }
159
 
160
+ #[allow(dead_code)]
161
  struct Detector {
162
  state: WhisperState<'static>,
163
  config: &'static WhisperConfig,