From c327ec699ba04c61305a4682249c4dea66b0aaa2 Mon Sep 17 00:00:00 2001 From: Niko Date: Fri, 15 Aug 2025 23:38:03 -0700 Subject: [PATCH] Simplify if conditional in `audio_transcription` example --- examples/audio_transcription.rs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/examples/audio_transcription.rs b/examples/audio_transcription.rs index ba61b87..13a508e 100644 --- a/examples/audio_transcription.rs +++ b/examples/audio_transcription.rs @@ -110,15 +110,7 @@ fn main() -> Result<(), &'static str> { let start_timestamp = segment.start_timestamp(); let end_timestamp = segment.end_timestamp(); - let first_token_dtw_ts = if segment.n_tokens() > 0 { - if let Some(token) = segment.get_token(0) { - token.token_data().t_dtw - } else { - -1i64 - } - } else { - -1i64 - }; + let first_token_dtw_ts = segment.get_token(0).map_or(-1, |t| t.token_data().t_dtw); // Print the segment to stdout. println!( "[{} - {} ({})]: {}",