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

chore(semantic): satisfy rustfmt and clippy on the Windows parser paths

Louis Beaumonta4ea2db82607
diff --git a/crates/screenpipe-semantic/examples/replay.rs b/crates/screenpipe-semantic/examples/replay.rs
index 8ce29b7d7..a2ebc2b14 100644
--- a/crates/screenpipe-semantic/examples/replay.rs
+++ b/crates/screenpipe-semantic/examples/replay.rs
@@ -4,8 +4,8 @@
use screenpipe_semantic::{
adapt_captured_accessibility_tree, parsers::builtin_parser_registry, render_semantic_context,
- AppIdentity, CapturedAccessibilityNode, NodeBounds, OutputBudget, ParseContext, ParserRegistry,
- Platform, TreeBudget, ValidatedParseOutcome,
+ AppIdentity, CapturedAccessibilityNode, OutputBudget, ParseContext, ParserRegistry, Platform,
+ TreeBudget, ValidatedParseOutcome,
};
use serde::{Deserialize, Serialize};
use std::io::{BufRead, Read};
@@ -273,6 +273,7 @@ fn parse_args(args: Vec<String>) -> Result<(AppIdentity, u64), String> {
#[cfg(test)]
mod tests {
use super::*;
+ use screenpipe_semantic::NodeBounds;
#[test]
fn metrics_never_serialize_captured_text() {
diff --git a/crates/screenpipe-semantic/src/parsers/claude.rs b/crates/screenpipe-semantic/src/parsers/claude.rs
index d9a6c2eb0..808bba19c 100644
--- a/crates/screenpipe-semantic/src/parsers/claude.rs
+++ b/crates/screenpipe-semantic/src/parsers/claude.rs
@@ -168,8 +168,12 @@ fn announcement_messages(tree: &SemanticTree) -> Option<Vec<(NodeId, &'static st
break;
}
}
- let has_user = announcements.iter().any(|(_, _, actor, _)| *actor == "[user]");
- let has_assistant = announcements.iter().any(|(_, _, actor, _)| *actor == "Claude");
+ let has_user = announcements
+ .iter()
+ .any(|(_, _, actor, _)| *actor == "[user]");
+ let has_assistant = announcements
+ .iter()
+ .any(|(_, _, actor, _)| *actor == "Claude");
if !has_user || !has_assistant {
return None;
}
@@ -195,7 +199,7 @@ fn announcement_messages(tree: &SemanticTree) -> Option<Vec<(NodeId, &'static st
(!messages.is_empty()).then_some(messages)
}
-fn announcement<'a>(tree: &'a SemanticTree, node: NodeId) -> Option<(&'static str, &'a str)> {
+fn announcement(tree: &SemanticTree, node: NodeId) -> Option<(&'static str, &str)> {
if !tree.role(node).is_some_and(|role| {
role.eq_ignore_ascii_case("Text") || role.eq_ignore_ascii_case("AXStaticText")
}) {
diff --git a/crates/screenpipe-semantic/src/parsers/families.rs b/crates/screenpipe-semantic/src/parsers/families.rs
index f6de600e5..af513fd31 100644
--- a/crates/screenpipe-semantic/src/parsers/families.rs
+++ b/crates/screenpipe-semantic/src/parsers/families.rs
@@ -670,7 +670,7 @@ fn chromium_document_root(tree: &SemanticTree) -> Option<NodeId> {
})
}
-fn button_label<'a>(tree: &'a SemanticTree, node: NodeId) -> Option<&'a str> {
+fn button_label(tree: &SemanticTree, node: NodeId) -> Option<&str> {
tree.role(node)
.filter(|role| role.eq_ignore_ascii_case("Button"))?;
node_content(tree, node)
@@ -803,7 +803,11 @@ fn joined_buffer_text(tree: &SemanticTree, buffer: &[NodeId]) -> Option<String>
let Some(content) = node_content(tree, node) else {
continue;
};
- for line in content.lines().map(str::trim).filter(|line| !line.is_empty()) {
+ for line in content
+ .lines()
+ .map(str::trim)
+ .filter(|line| !line.is_empty())
+ {
if lines.last() == Some(&line) {
continue;
}
diff --git a/crates/screenpipe-semantic/tests/family_parsers.rs b/crates/screenpipe-semantic/tests/family_parsers.rs
index 5671a3a38..989d07220 100644
--- a/crates/screenpipe-semantic/tests/family_parsers.rs
+++ b/crates/screenpipe-semantic/tests/family_parsers.rs
@@ -214,7 +214,8 @@ fn gmail_windows_fixture_extracts_list_rows_with_unread_state() {
assert!(rows.iter().all(|row| row.actor.is_some()));
assert!(rows.iter().all(|row| row.title.is_some()));
assert!(
- rows.iter().any(|row| row.status.as_deref() == Some("unread")),
+ rows.iter()
+ .any(|row| row.status.as_deref() == Some("unread")),
"unread rows carry the zE class marker"
);
// Subject and snippet are split, never concatenated into the subject.
@@ -249,14 +250,19 @@ fn chatgpt_windows_fixture_extracts_turns_from_role_description_headings() {
"Ask anything",
"New Chrome available",
] {
- assert!(!body.contains(chrome), "leaked browser/sidebar chrome: {chrome}");
+ assert!(
+ !body.contains(chrome),
+ "leaked browser/sidebar chrome: {chrome}"
+ );
}
}
}
#[test]
fn chatgpt_windows_landing_surface_is_empty_not_abstained() {
- let result = parse_fixture(include_str!("fixtures/families/chatgpt_windows_landing.json"));
+ let result = parse_fixture(include_str!(
+ "fixtures/families/chatgpt_windows_landing.json"
+ ));
assert_eq!(
result.selected_parser_id.as_deref(),
Some("app.chatgpt.turn_markers")