Skip to content

Commit a1af28b

Browse files
committed
Correct formatting
1 parent bcc47c9 commit a1af28b

3 files changed

Lines changed: 42 additions & 47 deletions

File tree

src/app.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -541,11 +541,7 @@ impl App {
541541
let mut ok = 0usize;
542542
let mut failed = 0usize;
543543
for idx in action.trash {
544-
match self
545-
.chat_sessions
546-
.get(idx)
547-
.map(chat::soft_delete)
548-
{
544+
match self.chat_sessions.get(idx).map(chat::soft_delete) {
549545
Some(Ok(())) => ok += 1,
550546
_ => failed += 1,
551547
}

src/chat.rs

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -161,15 +161,21 @@ struct SessionMeta {
161161
turn_count: usize,
162162
}
163163

164-
pub fn scan_all(workspace: &Path, provider_filter: Option<crate::types::ProviderId>) -> Vec<ChatSession> {
164+
pub fn scan_all(
165+
workspace: &Path,
166+
provider_filter: Option<crate::types::ProviderId>,
167+
) -> Vec<ChatSession> {
165168
let mut sessions = Vec::new();
166169
let include = |p: ChatProvider| -> bool {
167170
provider_filter.is_none_or(|prov| {
168171
matches!(
169172
(prov, p),
170173
(crate::types::ProviderId::Claude, ChatProvider::Claude)
171174
| (crate::types::ProviderId::Codex, ChatProvider::Codex)
172-
| (crate::types::ProviderId::Antigravity, ChatProvider::Antigravity)
175+
| (
176+
crate::types::ProviderId::Antigravity,
177+
ChatProvider::Antigravity
178+
)
173179
| (crate::types::ProviderId::Kiro, ChatProvider::Kiro)
174180
| (crate::types::ProviderId::OpenCode, ChatProvider::OpenCode)
175181
)
@@ -639,7 +645,8 @@ fn scan_opencode() -> Vec<ChatSession> {
639645
let Some(db_path) = opencode_db_path() else {
640646
return vec![];
641647
};
642-
let Ok(conn) = Connection::open_with_flags(&db_path, rusqlite::OpenFlags::SQLITE_OPEN_READ_ONLY)
648+
let Ok(conn) =
649+
Connection::open_with_flags(&db_path, rusqlite::OpenFlags::SQLITE_OPEN_READ_ONLY)
643650
else {
644651
return vec![];
645652
};
@@ -667,8 +674,8 @@ fn scan_opencode() -> Vec<ChatSession> {
667674
.map(|r| r.filter_map(|r| r.ok()).collect())
668675
.unwrap_or_default();
669676
rows.into_iter()
670-
.map(|(id, title, directory, created, updated, msg_count)| {
671-
ChatSession {
677+
.map(
678+
|(id, title, directory, created, updated, msg_count)| ChatSession {
672679
id: id.clone(),
673680
title,
674681
provider: ChatProvider::OpenCode,
@@ -681,8 +688,8 @@ fn scan_opencode() -> Vec<ChatSession> {
681688
size_bytes: 0,
682689
imported: false,
683690
trash_manifest: None,
684-
}
685-
})
691+
},
692+
)
686693
.collect()
687694
}
688695

@@ -715,8 +722,7 @@ fn load_opencode_archive(session: &ChatSession) -> Result<ChatArchive> {
715722
});
716723
}
717724
}
718-
if let Some(tool_name) = str_field(&val, &["name"]).or_else(|| str_field(&val, &["tool"]))
719-
{
725+
if let Some(tool_name) = str_field(&val, &["name"]).or_else(|| str_field(&val, &["tool"])) {
720726
tools.push(ChatToolCall {
721727
name: tool_name.to_string(),
722728
timestamp: None,
@@ -742,28 +748,27 @@ fn extract_text_field(val: &Value) -> String {
742748
str_field(val, &["content", "text", "message"])
743749
.map(ToOwned::to_owned)
744750
.or_else(|| {
745-
val.get("content")
746-
.and_then(|c| {
747-
if let Some(s) = c.as_str() {
748-
Some(s.to_string())
749-
} else if let Some(arr) = c.as_array() {
750-
let parts: Vec<String> = arr
751-
.iter()
752-
.filter_map(|item| {
753-
str_field(item, &["text"])
754-
.or_else(|| str_field(item, &["content"]))
755-
.map(ToOwned::to_owned)
756-
})
757-
.collect();
758-
if parts.is_empty() {
759-
None
760-
} else {
761-
Some(parts.join("\n"))
762-
}
763-
} else {
751+
val.get("content").and_then(|c| {
752+
if let Some(s) = c.as_str() {
753+
Some(s.to_string())
754+
} else if let Some(arr) = c.as_array() {
755+
let parts: Vec<String> = arr
756+
.iter()
757+
.filter_map(|item| {
758+
str_field(item, &["text"])
759+
.or_else(|| str_field(item, &["content"]))
760+
.map(ToOwned::to_owned)
761+
})
762+
.collect();
763+
if parts.is_empty() {
764764
None
765+
} else {
766+
Some(parts.join("\n"))
765767
}
766-
})
768+
} else {
769+
None
770+
}
771+
})
767772
})
768773
.unwrap_or_default()
769774
}

src/scanner.rs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -322,9 +322,9 @@ fn collect_hook_items(
322322
.get("hooks")
323323
.and_then(|h| h.as_array())
324324
.and_then(|a| a.first())
325-
.and_then(|h| h.get("name").or_else(|| h.get("command")))
326-
.and_then(|n| n.as_str())
327-
.map(String::from);
325+
.and_then(|h| h.get("name").or_else(|| h.get("command")))
326+
.and_then(|n| n.as_str())
327+
.map(String::from);
328328
let display = hook_name
329329
.clone()
330330
.unwrap_or_else(|| format!("{}: {}", event, matcher));
@@ -543,21 +543,15 @@ fn scan_kiro(root: &Path, scope: Scope) -> Vec<ConfigItem> {
543543
ProviderId::Kiro,
544544
));
545545

546-
for (agents_dir, force_disabled) in [
547-
(d.join("agents"), false),
548-
(d.join("agents.disabled"), true),
549-
] {
546+
for (agents_dir, force_disabled) in
547+
[(d.join("agents"), false), (d.join("agents.disabled"), true)]
548+
{
550549
if agents_dir.is_dir() {
551550
if let Ok(rd) = std::fs::read_dir(&agents_dir) {
552551
for e in rd.flatten() {
553552
let p = e.path();
554553
if p.extension().and_then(|e| e.to_str()) == Some("json") {
555-
items.extend(scan_hook_entries(
556-
&p,
557-
ProviderId::Kiro,
558-
&[],
559-
force_disabled,
560-
));
554+
items.extend(scan_hook_entries(&p, ProviderId::Kiro, &[], force_disabled));
561555
}
562556
}
563557
}

0 commit comments

Comments
 (0)