From a1acc61a2909194bf45d57e6957995677e966987 Mon Sep 17 00:00:00 2001 From: Niko Date: Wed, 30 Jul 2025 17:37:28 -0700 Subject: [PATCH] Remove unused lifetime --- src/whisper_params.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/whisper_params.rs b/src/whisper_params.rs index 63b4ce6..0741364 100644 --- a/src/whisper_params.rs +++ b/src/whisper_params.rs @@ -34,20 +34,19 @@ pub struct SegmentCallbackData { type SegmentCallbackFn = Box; #[derive(Clone)] -pub struct FullParams<'a, 'b, 'c> { +pub struct FullParams<'a, 'b> { pub(crate) fp: whisper_rs_sys::whisper_full_params, phantom_lang: PhantomData<&'a str>, phantom_tokens: PhantomData<&'b [c_int]>, - phantom_model_path: PhantomData<&'c str>, grammar: Option>, progress_callback_safe: Option>>, abort_callback_safe: Option bool>>>, segment_calllback_safe: Option>, } -impl<'a, 'b, 'c> FullParams<'a, 'b, 'c> { +impl<'a, 'b> FullParams<'a, 'b> { /// Create a new set of parameters for the decoder. - pub fn new(sampling_strategy: SamplingStrategy) -> FullParams<'a, 'b, 'c> { + pub fn new(sampling_strategy: SamplingStrategy) -> FullParams<'a, 'b> { let mut fp = unsafe { whisper_rs_sys::whisper_full_default_params(match sampling_strategy { SamplingStrategy::Greedy { .. } => { @@ -76,7 +75,6 @@ impl<'a, 'b, 'c> FullParams<'a, 'b, 'c> { fp, phantom_lang: PhantomData, phantom_tokens: PhantomData, - phantom_model_path: PhantomData, grammar: None, progress_callback_safe: None, abort_callback_safe: None, @@ -841,14 +839,14 @@ impl<'a, 'b, 'c> FullParams<'a, 'b, 'c> { // following implementations are safe // see https://github.com/ggerganov/whisper.cpp/issues/32#issuecomment-1272790388 // concurrent usage is prevented by &mut self on methods that modify the struct -unsafe impl Send for FullParams<'_, '_, '_> {} -unsafe impl Sync for FullParams<'_, '_, '_> {} +unsafe impl Send for FullParams<'_, '_> {} +unsafe impl Sync for FullParams<'_, '_> {} #[cfg(test)] mod test_whisper_params_initial_prompt { use super::*; - impl<'a, 'b, 'c> FullParams<'a, 'b, 'c> { + impl<'a, 'b> FullParams<'a, 'b> { pub fn get_initial_prompt(&self) -> &str { // SAFETY: Ensure this is safe and respects the lifetime of the string in self.fp unsafe {