Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix: cargo fmt + clippy fixes across crates

Louis Beaumonta3fb039a617b
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
index 18843d0da..864c0e2fa 100644
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -8223,7 +8223,7 @@ dependencies = [
[[package]]
name = "screenpipe-app"
-version = "2.0.623"
+version = "2.1.0"
dependencies = [
"anyhow",
"arboard",
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/permissions.rs b/apps/screenpipe-app-tauri/src-tauri/src/permissions.rs
index 21bf5c6cc..7087714af 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/permissions.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/permissions.rs
@@ -370,6 +370,27 @@ pub fn do_permissions_check(initial_check: bool) -> OSPermissionsCheck {
}
}
+/// Launch Arc if it's not already running, then wait briefly for it to start.
+/// The macOS Automation permission prompt requires the target app to be running.
+#[cfg(target_os = "macos")]
+fn ensure_arc_running() {
+ use std::process::Command;
+
+ // Check if Arc is already running via pgrep
+ let running = Command::new("pgrep")
+ .args(["-x", "Arc"])
+ .output()
+ .map(|o| o.status.success())
+ .unwrap_or(false);
+
+ if !running {
+ debug!("arc not running, launching it for automation permission prompt");
+ let _ = Command::new("open").args(["-a", "Arc"]).spawn();
+ // Give Arc a moment to launch before the permission API call
+ std::thread::sleep(std::time::Duration::from_secs(2));
+ }
+}
+
/// Check if Arc browser is installed (macOS only)
#[tauri::command(async)]
#[specta::specta]
@@ -565,6 +586,9 @@ fn run_self_detached_fire_and_forget(flag: &str) {
pub fn request_arc_automation_permission(_app: tauri::AppHandle) -> bool {
#[cfg(target_os = "macos")]
{
+ // Arc must be running for macOS to show the permission prompt
+ ensure_arc_running();
+
if is_app_bundle() {
let result = ae_check_automation_direct("company.thebrowser.Browser", true);
if result != 0 {
diff --git a/crates/screenpipe-accessibility/src/tree/macos.rs b/crates/screenpipe-accessibility/src/tree/macos.rs
index 2bbe9c357..6d35709b1 100644
--- a/crates/screenpipe-accessibility/src/tree/macos.rs
+++ b/crates/screenpipe-accessibility/src/tree/macos.rs
@@ -263,7 +263,7 @@ impl MacosTreeWalker {
// Ref: https://github.com/electron/electron/issues/7206
let eui_attr_name = cf::String::from_str("AXEnhancedUserInterface");
let eui_attr = ax::Attr::with_string(&eui_attr_name);
- let _ = ax_app.set_attr(&eui_attr, cf::Boolean::value_true());
+ let _ = ax_app.set_attr(eui_attr, cf::Boolean::value_true());
let window_val = match ax_app.attr_value(ax::attr::focused_window()) {
Ok(v) => v,
diff --git a/crates/screenpipe-audio/src/audio_manager/builder.rs b/crates/screenpipe-audio/src/audio_manager/builder.rs
index a86c628cb..3fb23fcc9 100644
--- a/crates/screenpipe-audio/src/audio_manager/builder.rs
+++ b/crates/screenpipe-audio/src/audio_manager/builder.rs
@@ -13,8 +13,10 @@ use crate::{
device::{default_input_device, default_output_device},
engine::AudioTranscriptionEngine,
},
- transcription::{deepgram::CUSTOM_DEEPGRAM_API_TOKEN, stt::OpenAICompatibleConfig, VocabularyEntry},
meeting_detector::MeetingDetector,
+ transcription::{
+ deepgram::CUSTOM_DEEPGRAM_API_TOKEN, stt::OpenAICompatibleConfig, VocabularyEntry,
+ },
vad::VadEngineEnum,
};
diff --git a/crates/screenpipe-audio/src/audio_manager/manager.rs b/crates/screenpipe-audio/src/audio_manager/manager.rs
index 604096bed..9c4e4807b 100644
--- a/crates/screenpipe-audio/src/audio_manager/manager.rs
+++ b/crates/screenpipe-audio/src/audio_manager/manager.rs
@@ -176,10 +176,10 @@ impl AudioManager {
let langs = opts.languages.clone();
let vocab = opts.vocabulary.clone();
drop(opts);
-
+
// Get whisper context from transcription engine
let whisper_ctx = transcription_engine.whisper_context();
-
+
let count = super::reconciliation::reconcile_untranscribed(
&db,
transcription_engine,
diff --git a/crates/screenpipe-audio/src/audio_manager/reconciliation.rs b/crates/screenpipe-audio/src/audio_manager/reconciliation.rs
index 554c707df..b89953463 100644
--- a/crates/screenpipe-audio/src/audio_manager/reconciliation.rs
+++ b/crates/screenpipe-audio/src/audio_manager/reconciliation.rs
@@ -8,13 +8,13 @@ use std::sync::Arc;
use screenpipe_db::{DatabaseManager, UntranscribedChunk};
use tracing::{debug, error, warn};
+use crate::core::engine::AudioTranscriptionEngine;
use crate::transcription::engine::{TranscriptionEngine, TranscriptionSession};
use crate::transcription::{AudioInsertCallback, AudioInsertInfo};
-use crate::core::engine::AudioTranscriptionEngine;
-use crate::OpenAICompatibleConfig;
use crate::transcription::VocabularyEntry;
use crate::utils::ffmpeg::read_audio_from_file;
+use crate::OpenAICompatibleConfig;
use screenpipe_core::Language;
use whisper_rs::WhisperContext;
@@ -145,7 +145,10 @@ pub async fn reconcile_untranscribed(
};
// Transcribe the concatenated audio in one shot using session
- let full_text = match session.transcribe(&combined_samples, sample_rate, &device_name).await {
+ let full_text = match session
+ .transcribe(&combined_samples, sample_rate, &device_name)
+ .await
+ {
Ok(t) => t,
Err(e) => {
error!("reconciliation: transcription failed for batch: {}", e);
diff --git a/crates/screenpipe-audio/src/transcription/engine.rs b/crates/screenpipe-audio/src/transcription/engine.rs
index c8f5cc243..549a0c32c 100644
--- a/crates/screenpipe-audio/src/transcription/engine.rs
+++ b/crates/screenpipe-audio/src/transcription/engine.rs
@@ -256,7 +256,7 @@ impl TranscriptionSession {
|| text.eq_ignore_ascii_case("language none")
|| text
.strip_prefix("language ")
- .map_or(false, |rest| rest.chars().all(|c| c.is_alphabetic()))
+ .is_some_and(|rest| rest.chars().all(|c| c.is_alphabetic()))
{
Ok(String::new())
} else {
diff --git a/crates/screenpipe-audio/src/transcription/openai_compatible/batch.rs b/crates/screenpipe-audio/src/transcription/openai_compatible/batch.rs
index 457af85e9..7317141d2 100644
--- a/crates/screenpipe-audio/src/transcription/openai_compatible/batch.rs
+++ b/crates/screenpipe-audio/src/transcription/openai_compatible/batch.rs
@@ -4,7 +4,7 @@
use anyhow::Result;
use hound::{WavSpec, WavWriter};
-use reqwest::{Client, Response, multipart};
+use reqwest::{multipart, Client, Response};
use screenpipe_core::Language;
use serde_json::Value;
use std::io::Cursor;
@@ -45,10 +45,8 @@ pub async fn transcribe_with_openai_compatible(
let wav_data = create_wav_file(audio_data, sample_rate)?;
// Build the request (with timeout to prevent hanging on unresponsive endpoints)
- let client = Client::builder()
- .timeout(Duration::from_secs(30))
- .build()?;
-
+ let client = Client::builder().timeout(Duration::from_secs(30)).build()?;
+
// Build multipart form
let mut form = multipart::Form::new()
.text("model", model.to_string())
@@ -59,7 +57,7 @@ pub async fn transcribe_with_openai_compatible(
.file_name("audio.wav")
.mime_str("audio/wav")?,
);
-
+
// Add language if specified
if !languages.is_empty() {
// Use the first language as the primary language hint
@@ -103,7 +101,7 @@ fn create_wav_file(audio_data: &[f32], sample_rate: u32) -> Result<Vec<u8>> {
} else {
sample_rate
};
-
+
let spec = WavSpec {
channels: 1,
sample_rate: target_sample_rate,
@@ -111,7 +109,7 @@ fn create_wav_file(audio_data: &[f32], sample_rate: u32) -> Result<Vec<u8>> {
sample_format: hound::SampleFormat::Float,
};
let mut writer = WavWriter::new(&mut cursor, spec)?;
-
+
// Simple decimation for downsampling if needed
if target_sample_rate < sample_rate && sample_rate > 0 {
let ratio = sample_rate / target_sample_rate;
@@ -133,19 +131,23 @@ fn create_wav_file(audio_data: &[f32], sample_rate: u32) -> Result<Vec<u8>> {
async fn handle_response(response: Response, device: &str) -> Result<String> {
let status = response.status();
-
+
if !status.is_success() {
- let error_text = response.text().await.unwrap_or_else(|_| "Unknown error".to_string());
+ let error_text = response
+ .text()
+ .await
+ .unwrap_or_else(|_| "Unknown error".to_string());
error!(
"OpenAI compatible API error (status {}): {}",
status, error_text
);
return Err(anyhow::anyhow!(
"API error (status {}): {}",
- status, error_text
+ status,
+ error_text
));
}
-
+
match response.json::<Value>().await {
Ok(result) => {
// Check for error in response body
@@ -186,10 +188,10 @@ mod tests {
let audio_data: Vec<f32> = vec![0.0, 0.5, 0.0, -0.5, 0.0];
let result = create_wav_file(&audio_data, 16000);
assert!(result.is_ok());
-
+
let wav_data = result.unwrap();
assert!(!wav_data.is_empty());
-
+
// Verify it's a valid WAV by reading it back
let cursor = Cursor::new(wav_data);
let reader = hound::WavReader::new(cursor).unwrap();
@@ -203,7 +205,7 @@ mod tests {
let audio_data: Vec<f32> = (0..44100).map(|i| (i as f32 / 44100.0).sin()).collect();
let result = create_wav_file(&audio_data, 44100);
assert!(result.is_ok());
-
+
let wav_data = result.unwrap();
let cursor = Cursor::new(wav_data);
let reader = hound::WavReader::new(cursor).unwrap();
diff --git a/crates/screenpipe-audio/src/transcription/stt.rs b/crates/screenpipe-audio/src/transcription/stt.rs
index ac41b9456..070008313 100644
--- a/crates/screenpipe-audio/src/transcription/stt.rs
+++ b/crates/screenpipe-audio/src/transcription/stt.rs
@@ -102,70 +102,80 @@ pub async fn stt(
vocabulary: &[VocabularyEntry],
alternate_stt: Option<AlternateSttEngine>,
) -> Result<String> {
- let transcription: Result<String> =
- if *audio_transcription_engine == AudioTranscriptionEngine::Disabled {
- Ok(String::new())
- } else if audio_transcription_engine == AudioTranscriptionEngine::Deepgram.into() {
- // Deepgram implementation
- let api_key = deepgram_api_key.unwrap_or_default();
+ let transcription: Result<String> = if *audio_transcription_engine
+ == AudioTranscriptionEngine::Disabled
+ {
+ Ok(String::new())
+ } else if audio_transcription_engine == AudioTranscriptionEngine::Deepgram.into() {
+ // Deepgram implementation
+ let api_key = deepgram_api_key.unwrap_or_default();
- match transcribe_with_deepgram(&api_key, audio, device, sample_rate, languages.clone(), vocabulary)
- .await
- {
- Ok(transcription) => Ok(transcription),
- Err(e) => {
- error!(
- "device: {}, deepgram transcription failed, falling back to Whisper: {:?}",
- device, e
- );
- // Fallback to Whisper
- process_with_whisper(audio, languages.clone(), whisper_state, vocabulary).await
- }
- }
- } else if *audio_transcription_engine == AudioTranscriptionEngine::Qwen3Asr {
- // Qwen3-ASR via alternate STT engine (audiopipe)
- if let Some(ref engine) = alternate_stt {
- let mut engine = engine.lock().map_err(|e| anyhow::anyhow!("stt model lock: {}", e))?;
- engine.transcribe(audio, sample_rate)
- } else {
- Err(anyhow::anyhow!("qwen3-asr model not initialized"))
+ match transcribe_with_deepgram(
+ &api_key,
+ audio,
+ device,
+ sample_rate,
+ languages.clone(),
+ vocabulary,
+ )
+ .await
+ {
+ Ok(transcription) => Ok(transcription),
+ Err(e) => {
+ error!(
+ "device: {}, deepgram transcription failed, falling back to Whisper: {:?}",
+ device, e
+ );
+ // Fallback to Whisper
+ process_with_whisper(audio, languages.clone(), whisper_state, vocabulary).await
}
- } else if audio_transcription_engine == AudioTranscriptionEngine::OpenAICompatible.into() {
- // OpenAI Compatible implementation
- let config = openai_compatible_config.unwrap_or_else(|| OpenAICompatibleConfig {
- endpoint: "http://127.0.0.1:8080".to_string(),
- api_key: None,
- model: "whisper-1".to_string(),
- });
+ }
+ } else if *audio_transcription_engine == AudioTranscriptionEngine::Qwen3Asr {
+ // Qwen3-ASR via alternate STT engine (audiopipe)
+ if let Some(ref engine) = alternate_stt {
+ let mut engine = engine
+ .lock()
+ .map_err(|e| anyhow::anyhow!("stt model lock: {}", e))?;
+ engine.transcribe(audio, sample_rate)
+ } else {
+ Err(anyhow::anyhow!("qwen3-asr model not initialized"))
+ }
+ } else if audio_transcription_engine == AudioTranscriptionEngine::OpenAICompatible.into() {
+ // OpenAI Compatible implementation
+ let config = openai_compatible_config.unwrap_or_else(|| OpenAICompatibleConfig {
+ endpoint: "http://127.0.0.1:8080".to_string(),
+ api_key: None,
+ model: "whisper-1".to_string(),
+ });
- // Collect vocabulary words for the prompt/context field
- let vocab_words: Vec<String> = vocabulary.iter().map(|v| v.word.clone()).collect();
- match transcribe_with_openai_compatible(
- &config.endpoint,
- config.api_key.as_deref(),
- &config.model,
- audio,
- device,
- sample_rate,
- languages.clone(),
- &vocab_words,
- )
- .await
- {
- Ok(transcription) => Ok(transcription),
- Err(e) => {
- error!(
+ // Collect vocabulary words for the prompt/context field
+ let vocab_words: Vec<String> = vocabulary.iter().map(|v| v.word.clone()).collect();
+ match transcribe_with_openai_compatible(
+ &config.endpoint,
+ config.api_key.as_deref(),
+ &config.model,
+ audio,
+ device,
+ sample_rate,
+ languages.clone(),
+ &vocab_words,
+ )
+ .await
+ {
+ Ok(transcription) => Ok(transcription),
+ Err(e) => {
+ error!(
"device: {}, openai compatible transcription failed, falling back to Whisper: {:?}",
device, e
);
- // Fallback to Whisper
- process_with_whisper(audio, languages.clone(), whisper_state, vocabulary).await
- }
+ // Fallback to Whisper
+ process_with_whisper(audio, languages.clone(), whisper_state, vocabulary).await
}
- } else {
- // Existing Whisper implementation
- process_with_whisper(audio, languages, whisper_state, vocabulary).await
- };
+ }
+ } else {
+ // Existing Whisper implementation
+ process_with_whisper(audio, languages, whisper_state, vocabulary).await
+ };
// Post-processing: apply vocabulary replacements
match transcription {
@@ -290,7 +300,10 @@ pub async fn run_stt(
) -> Result<TranscriptionResult> {
let audio = segment.samples.clone();
let sample_rate = segment.sample_rate;
- match session.transcribe(&audio, sample_rate, &device.to_string()).await {
+ match session
+ .transcribe(&audio, sample_rate, &device.to_string())
+ .await
+ {
Ok(transcription) => Ok(TranscriptionResult {
input: AudioInput {
data: Arc::new(audio),
diff --git a/crates/screenpipe-core/src/pipes/sync.rs b/crates/screenpipe-core/src/pipes/sync.rs
index 92969cf71..9361345a2 100644
--- a/crates/screenpipe-core/src/pipes/sync.rs
+++ b/crates/screenpipe-core/src/pipes/sync.rs
@@ -357,7 +357,7 @@ fn force_disabled(raw_content: &str) -> String {
fn parse_rfc3339(s: &str) -> DateTime<Utc> {
DateTime::parse_from_rfc3339(s)
.map(|dt| dt.with_timezone(&Utc))
- .unwrap_or_else(|_| DateTime::UNIX_EPOCH.into())
+ .unwrap_or_else(|_| DateTime::UNIX_EPOCH)
}
/// Parse an RFC 3339 timestamp, returning None on failure.
diff --git a/crates/screenpipe-db/src/db.rs b/crates/screenpipe-db/src/db.rs
index b75b4ca12..a2dde17a5 100644
--- a/crates/screenpipe-db/src/db.rs
+++ b/crates/screenpipe-db/src/db.rs
@@ -1461,10 +1461,7 @@ impl DatabaseManager {
match result {
Ok(id) => {
// Trim stack to current depth, then push
- while depth_stack
- .last()
- .map_or(false, |(d, _)| *d as i32 >= depth)
- {
+ while depth_stack.last().is_some_and(|(d, _)| *d as i32 >= depth) {
depth_stack.pop();
}
depth_stack.push((node.depth, id));
diff --git a/crates/screenpipe-db/tests/search_ocr_snapshot_test.rs b/crates/screenpipe-db/tests/search_ocr_snapshot_test.rs
index 52700eca1..6269c865d 100644
--- a/crates/screenpipe-db/tests/search_ocr_snapshot_test.rs
+++ b/crates/screenpipe-db/tests/search_ocr_snapshot_test.rs
@@ -143,7 +143,17 @@ mod tests {
ContentType::OCR,
2,
0,
- None, None, None, None, None, None, None, None, None, None, None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
)
.await
.unwrap();
@@ -156,7 +166,17 @@ mod tests {
ContentType::OCR,
2,
2,
- None, None, None, None, None, None, None, None, None, None, None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
)
.await
.unwrap();
@@ -169,7 +189,17 @@ mod tests {
ContentType::OCR,
2,
4,
- None, None, None, None, None, None, None, None, None, None, None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
)
.await
.unwrap();
@@ -252,7 +282,17 @@ mod tests {
ContentType::All,
2,
0,
- None, None, None, None, None, None, None, None, None, None, None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
)
.await
.unwrap();
@@ -342,7 +382,17 @@ mod tests {
ContentType::All,
3,
0,
- None, None, None, None, None, None, None, None, None, None, None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
)
.await
.unwrap();
@@ -362,7 +412,17 @@ mod tests {
ContentType::All,
3,
3,
- None, None, None, None, None, None, None, None, None, None, None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
)
.await
.unwrap();
diff --git a/crates/screenpipe-server/src/archive.rs b/crates/screenpipe-server/src/archive.rs
index d464c40a9..242777515 100644
--- a/crates/screenpipe-server/src/archive.rs
+++ b/crates/screenpipe-server/src/archive.rs
@@ -186,8 +186,8 @@ pub async fn archive_init(
// Derive encryption password from the token (only used when sync is not active)
let password = format!(
- "screenpipe-archive-{}",
- format!("{:x}", md5::compute(request.token.as_bytes()))
+ "screenpipe-archive-{:x}",
+ md5::compute(request.token.as_bytes())
);
mgr.initialize(&password).await.map_err(|e| {
diff --git a/crates/screenpipe-server/src/calendar_bridge.rs b/crates/screenpipe-server/src/calendar_bridge.rs
index d6b0dd926..dfbb04387 100644
--- a/crates/screenpipe-server/src/calendar_bridge.rs
+++ b/crates/screenpipe-server/src/calendar_bridge.rs
@@ -46,18 +46,16 @@ pub fn start_calendar_bridge(detector: Arc<MeetingDetector>) -> JoinHandle<()> {
.filter(|item| !item.is_all_day)
.filter_map(|item| {
let start = DateTime::parse_from_rfc3339(&item.start)
- .map_err(|e| {
+ .inspect_err(|&e| {
warn!(
"calendar bridge: failed to parse start '{}': {}",
item.start, e
);
- e
})
.ok()?;
let end = DateTime::parse_from_rfc3339(&item.end)
- .map_err(|e| {
+ .inspect_err(|&e| {
warn!("calendar bridge: failed to parse end '{}': {}", item.end, e);
- e
})
.ok()?;
Some(CalendarSignal {
diff --git a/crates/screenpipe-server/src/calendar_speaker_id.rs b/crates/screenpipe-server/src/calendar_speaker_id.rs
index d7c59f655..2e0a6cb66 100644
--- a/crates/screenpipe-server/src/calendar_speaker_id.rs
+++ b/crates/screenpipe-server/src/calendar_speaker_id.rs
@@ -225,13 +225,13 @@ fn names_match(user_name: &str, attendee: &str) -> bool {
// Extract name part if email
let user_name_part = if let Some(before_at) = user.split('@').next() {
- before_at.replace('.', " ").replace('_', " ")
+ before_at.replace(['.', '_'], " ")
} else {
user.clone()
};
let att_name_part = if let Some(before_at) = att.split('@').next() {
- before_at.replace('.', " ").replace('_', " ")
+ before_at.replace(['.', '_'], " ")
} else {
att.clone()
};
@@ -243,18 +243,12 @@ fn names_match(user_name: &str, attendee: &str) -> bool {
// First name prefix: "alice" matches "alice smith"
if att_name_part.starts_with(&user_name_part)
- && att_name_part
- .chars()
- .nth(user_name_part.len())
- .map_or(false, |c| c == ' ')
+ && (att_name_part.chars().nth(user_name_part.len()) == Some(' '))
{
return true;
}
if user_name_part.starts_with(&att_name_part)
- && user_name_part
- .chars()
- .nth(att_name_part.len())
- .map_or(false, |c| c == ' ')
+ && (user_name_part.chars().nth(att_name_part.len()) == Some(' '))
{
return true;
}
diff --git a/crates/screenpipe-server/src/event_driven_capture.rs b/crates/screenpipe-server/src/event_driven_capture.rs
index 26bbecedd..4e4aa82c2 100644
--- a/crates/screenpipe-server/src/event_driven_capture.rs
+++ b/crates/screenpipe-server/src/event_driven_capture.rs
@@ -270,8 +270,7 @@ pub async fn event_driven_capture_loop(
last_content_hash = result.content_hash;
last_db_write = Instant::now();
vision_metrics.record_capture();
- vision_metrics
- .record_db_write(Duration::from_millis(result.duration_ms as u64));
+ vision_metrics.record_db_write(Duration::from_millis(result.duration_ms));
if let Some(ref cache) = hot_frame_cache {
push_to_hot_cache(cache, result, &device_name, &CaptureTrigger::Manual)
.await;
@@ -408,7 +407,7 @@ pub async fn event_driven_capture_loop(
last_db_write = Instant::now();
vision_metrics.record_capture();
vision_metrics
- .record_db_write(Duration::from_millis(result.duration_ms as u64));
+ .record_db_write(Duration::from_millis(result.duration_ms));
if let Some(ref cache) = hot_frame_cache {
push_to_hot_cache(cache, result, &device_name, &trigger).await;
diff --git a/crates/screenpipe-server/src/hot_frame_cache.rs b/crates/screenpipe-server/src/hot_frame_cache.rs
index 497b2a52d..5b41a60d8 100644
--- a/crates/screenpipe-server/src/hot_frame_cache.rs
+++ b/crates/screenpipe-server/src/hot_frame_cache.rs
@@ -61,6 +61,12 @@ pub struct HotFrameCache {
cache_day: RwLock<u32>,
}
+impl Default for HotFrameCache {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl HotFrameCache {
/// Create a new empty cache with broadcast channels (capacity 256).
pub fn new() -> Self {
diff --git a/crates/screenpipe-server/src/paired_capture.rs b/crates/screenpipe-server/src/paired_capture.rs
index 8172a8778..13f108a28 100644
--- a/crates/screenpipe-server/src/paired_capture.rs
+++ b/crates/screenpipe-server/src/paired_capture.rs
@@ -97,7 +97,7 @@ pub async fn paired_capture(
// which returns non-empty but low-quality text (raw buffer content
// without visual formatting). For these apps we always run OCR to get
// proper bounding-box text positions for the selectable overlay.
- let app_prefers_ocr = ctx.app_name.map_or(false, |name| {
+ let app_prefers_ocr = ctx.app_name.is_some_and(|name| {
let n = name.to_lowercase();
// Terminal emulators whose AX text is raw buffer and not useful
// for bounding-box overlay. OCR produces better results.
@@ -207,7 +207,7 @@ pub async fn paired_capture(
// This sanitizes emails, API keys, credit cards, SSNs, etc. from OCR/accessibility text
// so pipes (like obsidian-sync) never see raw PII in search results.
let sanitized_text = if ctx.use_pii_removal {
- final_text.map(|t| remove_pii(t))
+ final_text.map(remove_pii)
} else {
final_text.map(|t| t.to_string())
};
diff --git a/crates/screenpipe-server/src/recording_config.rs b/crates/screenpipe-server/src/recording_config.rs
index 31ff41d57..99caa7eaa 100644
--- a/crates/screenpipe-server/src/recording_config.rs
+++ b/crates/screenpipe-server/src/recording_config.rs
@@ -50,7 +50,7 @@ pub struct RecordingConfig {
// Cloud/auth
pub deepgram_api_key: Option<String>,
pub user_id: Option<String>,
-
+
// OpenAI Compatible transcription
pub openai_compatible_endpoint: Option<String>,
pub openai_compatible_api_key: Option<String>,
diff --git a/crates/screenpipe-server/src/routes/streaming.rs b/crates/screenpipe-server/src/routes/streaming.rs
index cea34a120..43eb5c3e7 100644
--- a/crates/screenpipe-server/src/routes/streaming.rs
+++ b/crates/screenpipe-server/src/routes/streaming.rs
@@ -326,10 +326,10 @@ async fn handle_stream_frames_socket(
}
sent.insert(chunk.frame_id);
let frame = create_time_series_frame(chunk);
- if !frame.frame_data.is_empty() {
- if frame_tx_db.send(frame).await.is_err() {
- break;
- }
+ if !frame.frame_data.is_empty()
+ && frame_tx_db.send(frame).await.is_err()
+ {
+ break;
}
}
info!("Today DB backfill complete");