Skip to content

Commit 245111c

Browse files
committed
clippy
1 parent cfa514b commit 245111c

File tree

1 file changed

+55
-55
lines changed

1 file changed

+55
-55
lines changed

apps/desktop/src-tauri/src/captions.rs

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -396,17 +396,17 @@ async fn extract_audio_from_video(video_path: &str, output_path: &PathBuf) -> Re
396396

397397
{
398398
for (stream_idx, packet) in input.packets() {
399-
if stream_idx.index() == input_stream_index {
400-
if let Some(data) = packet.data() {
401-
let mut cloned_packet = ffmpeg::Packet::copy(data);
402-
if let Some(pts) = packet.pts() {
403-
cloned_packet.set_pts(Some(pts));
404-
}
405-
if let Some(dts) = packet.dts() {
406-
cloned_packet.set_dts(Some(dts));
407-
}
408-
packet_queue.push(cloned_packet);
399+
if stream_idx.index() == input_stream_index
400+
&& let Some(data) = packet.data()
401+
{
402+
let mut cloned_packet = ffmpeg::Packet::copy(data);
403+
if let Some(pts) = packet.pts() {
404+
cloned_packet.set_pts(Some(pts));
405+
}
406+
if let Some(dts) = packet.dts() {
407+
cloned_packet.set_dts(Some(dts));
409408
}
409+
packet_queue.push(cloned_packet);
410410
}
411411
}
412412
}
@@ -673,20 +673,20 @@ fn process_with_whisper(
673673
);
674674

675675
if token_text.starts_with(' ') || token_text.starts_with('\n') {
676-
if !current_word.is_empty() {
677-
if let Some(ws) = word_start {
678-
log::info!(
679-
" -> Completing word: '{}' ({:.2}s - {:.2}s)",
680-
current_word.trim(),
681-
ws,
682-
word_end
683-
);
684-
words.push(CaptionWord {
685-
text: current_word.trim().to_string(),
686-
start: ws,
687-
end: word_end,
688-
});
689-
}
676+
if !current_word.is_empty()
677+
&& let Some(ws) = word_start
678+
{
679+
log::info!(
680+
" -> Completing word: '{}' ({:.2}s - {:.2}s)",
681+
current_word.trim(),
682+
ws,
683+
word_end
684+
);
685+
words.push(CaptionWord {
686+
text: current_word.trim().to_string(),
687+
start: ws,
688+
end: word_end,
689+
});
690690
}
691691
current_word = token_text.trim().to_string();
692692
word_start = Some(token_start);
@@ -714,20 +714,20 @@ fn process_with_whisper(
714714
}
715715
}
716716

717-
if !current_word.trim().is_empty() {
718-
if let Some(ws) = word_start {
719-
log::info!(
720-
" -> Final word: '{}' ({:.2}s - {:.2}s)",
721-
current_word.trim(),
722-
ws,
723-
word_end
724-
);
725-
words.push(CaptionWord {
726-
text: current_word.trim().to_string(),
727-
start: ws,
728-
end: word_end,
729-
});
730-
}
717+
if !current_word.trim().is_empty()
718+
&& let Some(ws) = word_start
719+
{
720+
log::info!(
721+
" -> Final word: '{}' ({:.2}s - {:.2}s)",
722+
current_word.trim(),
723+
ws,
724+
word_end
725+
);
726+
words.push(CaptionWord {
727+
text: current_word.trim().to_string(),
728+
start: ws,
729+
end: word_end,
730+
});
731731
}
732732

733733
log::info!(" Segment {} produced {} words", i, words.len());
@@ -808,15 +808,15 @@ fn find_python() -> Option<String> {
808808
};
809809

810810
for cmd in python_commands {
811-
if let Ok(output) = Command::new(cmd).arg("--version").output() {
812-
if output.status.success() {
813-
let version = String::from_utf8_lossy(&output.stdout);
814-
if version.contains("Python 3")
815-
|| String::from_utf8_lossy(&output.stderr).contains("Python 3")
816-
{
817-
log::info!("Found Python 3 at: {}", cmd);
818-
return Some(cmd.to_string());
819-
}
811+
if let Ok(output) = Command::new(cmd).arg("--version").output()
812+
&& output.status.success()
813+
{
814+
let version = String::from_utf8_lossy(&output.stdout);
815+
if version.contains("Python 3")
816+
|| String::from_utf8_lossy(&output.stderr).contains("Python 3")
817+
{
818+
log::info!("Found Python 3 at: {}", cmd);
819+
return Some(cmd.to_string());
820820
}
821821
}
822822
}
@@ -1572,14 +1572,14 @@ pub async fn transcribe_audio(
15721572
Err("Server not available".to_string())
15731573
};
15741574

1575-
if let Err(ref e) = result {
1576-
if is_server_communication_error(e) {
1577-
log::warn!(
1578-
"Server communication error detected, clearing dead server: {}",
1579-
e
1580-
);
1581-
*server_guard = None;
1582-
}
1575+
if let Err(ref e) = result
1576+
&& is_server_communication_error(e)
1577+
{
1578+
log::warn!(
1579+
"Server communication error detected, clearing dead server: {}",
1580+
e
1581+
);
1582+
*server_guard = None;
15831583
}
15841584

15851585
result

0 commit comments

Comments
 (0)