From 8bf14ec8991b418512ca848b8346a9aef43863d3 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Thu, 19 Mar 2026 00:28:21 +0000 Subject: [PATCH 1/2] fix: apply cargo clippy fixes - Simplify boolean expression in transcript speaker resolution (nonminimal_bool) - Remove needless Ok/? wrapper in listener-core recorder restart (needless_question_mark) - Collapse nested if/if-let into let-chains in owhisper-client and transcript crates - Add missing plugins/apple-contact and plugins/pdf to Cargo workspace exclude list Co-Authored-By: bot_apk --- Cargo.toml | 2 ++ .../src/actors/session/supervisor/children.rs | 2 +- .../src/adapter/cactus/batch.rs | 5 ++--- .../src/adapter/soniox/live.rs | 6 ++--- crates/transcript/src/label.rs | 5 ++--- crates/transcript/src/segments/collect.rs | 5 ++--- crates/transcript/src/segments/speakers.rs | 22 +++++++------------ 7 files changed, 20 insertions(+), 27 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ad57d80e74..963211b8c6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,9 +18,11 @@ members = [ ] exclude = [ "plugins/apple-calendar", + "plugins/apple-contact", "plugins/cli2", "plugins/db", "plugins/extensions", + "plugins/pdf", "crates/vad-ext", ] diff --git a/crates/listener-core/src/actors/session/supervisor/children.rs b/crates/listener-core/src/actors/session/supervisor/children.rs index 5b28f390e3..9bac09eb3d 100644 --- a/crates/listener-core/src/actors/session/supervisor/children.rs +++ b/crates/listener-core/src/actors/session/supervisor/children.rs @@ -174,7 +174,7 @@ pub(super) async fn try_restart_recorder( let cell = spawn_with_retry(&RETRY_STRATEGY, || { let sup = sup.clone(); let ctx = ctx.clone(); - async move { Ok(spawn_recorder(sup, &ctx).await?) } + async move { spawn_recorder(sup, &ctx).await } }) .await; diff --git a/crates/owhisper-client/src/adapter/cactus/batch.rs b/crates/owhisper-client/src/adapter/cactus/batch.rs index eb2bc25916..5fa4ad7588 100644 --- a/crates/owhisper-client/src/adapter/cactus/batch.rs +++ b/crates/owhisper-client/src/adapter/cactus/batch.rs @@ -310,15 +310,14 @@ impl SseParserState { &mut self, response: StreamResponse, ) -> Option> { - if let StreamResponse::TranscriptResponse { channel, .. } = &response { - if channel + if let StreamResponse::TranscriptResponse { channel, .. } = &response + && channel .alternatives .first() .is_some_and(|a| !a.words.is_empty()) { self.saw_segment_words = true; } - } let segment_end = match &response { StreamResponse::TranscriptResponse { diff --git a/crates/owhisper-client/src/adapter/soniox/live.rs b/crates/owhisper-client/src/adapter/soniox/live.rs index eef52d7895..ce3d4bcc7d 100644 --- a/crates/owhisper-client/src/adapter/soniox/live.rs +++ b/crates/owhisper-client/src/adapter/soniox/live.rs @@ -293,9 +293,9 @@ fn build_words(tokens: &[&soniox::Token]) -> Vec( - tokens: &'a [soniox::Token], -) -> (Vec<&'a soniox::Token>, Vec<&'a soniox::Token>) { +fn partition_tokens_by_word_finality( + tokens: &[soniox::Token], +) -> (Vec<&soniox::Token>, Vec<&soniox::Token>) { let mut final_tokens = Vec::new(); let mut non_final_tokens = Vec::new(); for group in token_groups_from_values(tokens) { diff --git a/crates/transcript/src/label.rs b/crates/transcript/src/label.rs index bf18f53c5d..8c29ee2fd5 100644 --- a/crates/transcript/src/label.rs +++ b/crates/transcript/src/label.rs @@ -77,14 +77,13 @@ pub fn render_speaker_label( return human_id.clone(); } - if key.channel == ChannelProfile::DirectMic { - if let Some(self_human_id) = ctx.self_human_id.as_ref() { + if key.channel == ChannelProfile::DirectMic + && let Some(self_human_id) = ctx.self_human_id.as_ref() { if let Some(name) = ctx.human_name_by_id.get(self_human_id) { return name.clone(); } return "You".to_string(); } - } } else if let Some(human_id) = key.speaker_human_id.as_ref() { return human_id.clone(); } diff --git a/crates/transcript/src/segments/collect.rs b/crates/transcript/src/segments/collect.rs index 69c0ae50e6..c0f9fcbbbb 100644 --- a/crates/transcript/src/segments/collect.rs +++ b/crates/transcript/src/segments/collect.rs @@ -95,11 +95,10 @@ fn determine_key( segments: &[ProtoSegment], last_segment_by_channel: &HashMap, ) -> SegmentKey { - if !frame.word.is_final { - if let Some(&index) = last_segment_by_channel.get(&frame.word.channel) { + if !frame.word.is_final + && let Some(&index) = last_segment_by_channel.get(&frame.word.channel) { return segments[index].key.clone(); } - } create_segment_key(frame.word.channel, frame.identity.as_ref()) } diff --git a/crates/transcript/src/segments/speakers.rs b/crates/transcript/src/segments/speakers.rs index bd1bd3a6e9..77e2ab591a 100644 --- a/crates/transcript/src/segments/speakers.rs +++ b/crates/transcript/src/segments/speakers.rs @@ -118,22 +118,19 @@ fn apply_identity_rules( ) -> SpeakerIdentity { let mut identity = assignment.cloned().unwrap_or_default(); - if identity.speaker_index.is_some() && identity.human_id.is_none() { - if let Some(speaker_index) = identity.speaker_index { - if let Some(human_id) = state.human_id_by_speaker_index.get(&speaker_index) { + if identity.speaker_index.is_some() && identity.human_id.is_none() + && let Some(speaker_index) = identity.speaker_index + && let Some(human_id) = state.human_id_by_speaker_index.get(&speaker_index) { identity.human_id = Some(human_id.clone()); } - } - } - if identity.human_id.is_none() && state.complete_channels.contains(&word.channel) { - if let Some(human_id) = state.human_id_by_channel.get(&word.channel) { + if identity.human_id.is_none() && state.complete_channels.contains(&word.channel) + && let Some(human_id) = state.human_id_by_channel.get(&word.channel) { identity.human_id = Some(human_id.clone()); } - } - if !word.is_final && !(identity.speaker_index.is_some() && identity.human_id.is_some()) { - if let Some(last) = state.last_speaker_by_channel.get(&word.channel) { + if !(word.is_final || identity.speaker_index.is_some() && identity.human_id.is_some()) + && let Some(last) = state.last_speaker_by_channel.get(&word.channel) { if identity.speaker_index.is_none() { identity.speaker_index = last.speaker_index; } @@ -141,7 +138,6 @@ fn apply_identity_rules( identity.human_id = last.human_id.clone(); } } - } identity } @@ -165,11 +161,9 @@ fn remember_identity( if state.complete_channels.contains(&word.channel) && identity.human_id.is_some() && identity.speaker_index.is_none() - { - if let Some(human_id) = identity.human_id.clone() { + && let Some(human_id) = identity.human_id.clone() { state.human_id_by_channel.insert(word.channel, human_id); } - } if (!word.is_final || identity.speaker_index.is_some() || has_explicit_assignment) && !identity.is_empty() From f09e416f75121bbd6c2c47462b43cd8678dcf2cd Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Thu, 19 Mar 2026 00:35:20 +0000 Subject: [PATCH 2/2] style: run dprint fmt on clippy-fixed files Co-Authored-By: bot_apk --- .../src/adapter/cactus/batch.rs | 6 +-- crates/transcript/src/label.rs | 11 ++--- crates/transcript/src/segments/collect.rs | 7 ++-- crates/transcript/src/segments/speakers.rs | 42 +++++++++++-------- 4 files changed, 37 insertions(+), 29 deletions(-) diff --git a/crates/owhisper-client/src/adapter/cactus/batch.rs b/crates/owhisper-client/src/adapter/cactus/batch.rs index 5fa4ad7588..659f291349 100644 --- a/crates/owhisper-client/src/adapter/cactus/batch.rs +++ b/crates/owhisper-client/src/adapter/cactus/batch.rs @@ -315,9 +315,9 @@ impl SseParserState { .alternatives .first() .is_some_and(|a| !a.words.is_empty()) - { - self.saw_segment_words = true; - } + { + self.saw_segment_words = true; + } let segment_end = match &response { StreamResponse::TranscriptResponse { diff --git a/crates/transcript/src/label.rs b/crates/transcript/src/label.rs index 8c29ee2fd5..7cfdb8ea52 100644 --- a/crates/transcript/src/label.rs +++ b/crates/transcript/src/label.rs @@ -78,12 +78,13 @@ pub fn render_speaker_label( } if key.channel == ChannelProfile::DirectMic - && let Some(self_human_id) = ctx.self_human_id.as_ref() { - if let Some(name) = ctx.human_name_by_id.get(self_human_id) { - return name.clone(); - } - return "You".to_string(); + && let Some(self_human_id) = ctx.self_human_id.as_ref() + { + if let Some(name) = ctx.human_name_by_id.get(self_human_id) { + return name.clone(); } + return "You".to_string(); + } } else if let Some(human_id) = key.speaker_human_id.as_ref() { return human_id.clone(); } diff --git a/crates/transcript/src/segments/collect.rs b/crates/transcript/src/segments/collect.rs index c0f9fcbbbb..fb76532267 100644 --- a/crates/transcript/src/segments/collect.rs +++ b/crates/transcript/src/segments/collect.rs @@ -96,9 +96,10 @@ fn determine_key( last_segment_by_channel: &HashMap, ) -> SegmentKey { if !frame.word.is_final - && let Some(&index) = last_segment_by_channel.get(&frame.word.channel) { - return segments[index].key.clone(); - } + && let Some(&index) = last_segment_by_channel.get(&frame.word.channel) + { + return segments[index].key.clone(); + } create_segment_key(frame.word.channel, frame.identity.as_ref()) } diff --git a/crates/transcript/src/segments/speakers.rs b/crates/transcript/src/segments/speakers.rs index 77e2ab591a..86b2bcf230 100644 --- a/crates/transcript/src/segments/speakers.rs +++ b/crates/transcript/src/segments/speakers.rs @@ -118,26 +118,31 @@ fn apply_identity_rules( ) -> SpeakerIdentity { let mut identity = assignment.cloned().unwrap_or_default(); - if identity.speaker_index.is_some() && identity.human_id.is_none() + if identity.speaker_index.is_some() + && identity.human_id.is_none() && let Some(speaker_index) = identity.speaker_index - && let Some(human_id) = state.human_id_by_speaker_index.get(&speaker_index) { - identity.human_id = Some(human_id.clone()); - } + && let Some(human_id) = state.human_id_by_speaker_index.get(&speaker_index) + { + identity.human_id = Some(human_id.clone()); + } - if identity.human_id.is_none() && state.complete_channels.contains(&word.channel) - && let Some(human_id) = state.human_id_by_channel.get(&word.channel) { - identity.human_id = Some(human_id.clone()); - } + if identity.human_id.is_none() + && state.complete_channels.contains(&word.channel) + && let Some(human_id) = state.human_id_by_channel.get(&word.channel) + { + identity.human_id = Some(human_id.clone()); + } if !(word.is_final || identity.speaker_index.is_some() && identity.human_id.is_some()) - && let Some(last) = state.last_speaker_by_channel.get(&word.channel) { - if identity.speaker_index.is_none() { - identity.speaker_index = last.speaker_index; - } - if identity.human_id.is_none() { - identity.human_id = last.human_id.clone(); - } + && let Some(last) = state.last_speaker_by_channel.get(&word.channel) + { + if identity.speaker_index.is_none() { + identity.speaker_index = last.speaker_index; } + if identity.human_id.is_none() { + identity.human_id = last.human_id.clone(); + } + } identity } @@ -161,9 +166,10 @@ fn remember_identity( if state.complete_channels.contains(&word.channel) && identity.human_id.is_some() && identity.speaker_index.is_none() - && let Some(human_id) = identity.human_id.clone() { - state.human_id_by_channel.insert(word.channel, human_id); - } + && let Some(human_id) = identity.human_id.clone() + { + state.human_id_by_channel.insert(word.channel, human_id); + } if (!word.is_final || identity.speaker_index.is_some() || has_explicit_assignment) && !identity.is_empty()