style: fix clippy errors and formatting drift

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
johannesandClaude Sonnet 5.5 committed 2026-11-28 14:15:03 +01:00
1 parent 164671a0c5
commit 13d914c8c0
5 files changed
+55 -28

No files matched your search

+4 -1
View File
@@ -484,6 +484,9 @@ mod tests {
}
tokio::time::sleep(std::time::Duration::from_millis(50)).await;
}
panic!("child {pid} survived: {:?}", std::fs::read_to_string(format!("/proc/{pid}/stat")));
panic!(
"child {pid} survived: {:?}",
std::fs::read_to_string(format!("/proc/{pid}/stat"))
);
}
}
+10 -9
View File
@@ -517,15 +517,16 @@ impl Tool for Task {
spec_for(&self.kinds())
}
async fn call(&self, a: Value, cx: &ToolCtx) -> ToolResult {
if a["prompt"].is_null() && a["prompts"].is_null() {
if let Some(w) = a["wait"].as_array() {
let ids: Vec<usize> = w
.iter()
.filter_map(|v| v.as_u64())
.map(|n| n as usize)
.collect();
return self.wait(&ids, cx).await;
}
if a["prompt"].is_null()
&& a["prompts"].is_null()
&& let Some(w) = a["wait"].as_array()
{
let ids: Vec<usize> = w
.iter()
.filter_map(|v| v.as_u64())
.map(|n| n as usize)
.collect();
return self.wait(&ids, cx).await;
}
if a["background"].as_bool() == Some(true) {
let ps: Vec<&str> = match a["prompts"].as_array() {
+8 -6
View File
@@ -110,6 +110,12 @@ impl Hook for Forward {
}
}
type DocPrompt = (
doc_view::DocView,
hx_core::Question,
tokio::sync::oneshot::Sender<Option<Vec<String>>>,
);
struct App {
t: Transcript,
ed: Editor,
@@ -143,11 +149,7 @@ struct App {
tokio::sync::oneshot::Sender<hx_core::permit::Decision>,
)>,
review: Option<review::Review>,
doc: Option<(
doc_view::DocView,
hx_core::Question,
tokio::sync::oneshot::Sender<Option<Vec<String>>>,
)>,
doc: Option<DocPrompt>,
probe: bool,
kbd: bool,
stats: Option<(hx_core::stats::Summary, String)>,
@@ -967,7 +969,7 @@ fn chat_buf(app: &App) -> (Buffer, Vec<bool>) {
.line_count(w)
.max(1);
cont.push(false);
cont.extend(std::iter::repeat(true).take(n - 1));
cont.extend(std::iter::repeat_n(true, n - 1));
}
let para = Paragraph::new(lines).wrap(Wrap { trim: false });
let r = Rect::new(0, 0, w, para.line_count(w) as u16);
-3
View File
@@ -234,9 +234,6 @@ impl W {
self.text(" ", st);
} else {
self.flush();
if self.lists.is_empty() {
return;
}
}
}
Event::Rule => {
+33 -9
View File
@@ -365,9 +365,13 @@ fn lsp_card(c: &View) -> Vec<Line<'static>> {
if b.is_empty() {
b.push(Line::styled("no servers started", th.dim()));
}
let (errs, warns) = c.lens.diags.iter().fold((0, 0), |(e, w), d| {
if d.error { (e + 1, w) } else { (e, w + 1) }
});
let (errs, warns) =
c.lens.diags.iter().fold(
(0, 0),
|(e, w), d| {
if d.error { (e + 1, w) } else { (e, w + 1) }
},
);
if errs + warns > 0 {
let mut ds = c.lens.diags.clone();
ds.sort_by_key(|d| (!d.error, d.file.clone(), d.line));
@@ -393,7 +397,10 @@ fn lsp_card(c: &View) -> Vec<Line<'static>> {
}
let mut right = format!("{up}/{} ready", c.lens_lines.len());
if errs + warns > 0 {
right += &format!(" {} {}{errs} {}{warns}", th.sym.info, th.sym.err, th.sym.warn);
right += &format!(
" {} {}{errs} {}{warns}",
th.sym.info, th.sym.err, th.sym.warn
);
}
let border = if bad || errs > 0 {
th.err()
@@ -544,7 +551,12 @@ mod tests {
fn text(ls: &[Line]) -> String {
ls.iter()
.map(|l| l.spans.iter().map(|s| s.content.as_ref()).collect::<String>())
.map(|l| {
l.spans
.iter()
.map(|s| s.content.as_ref())
.collect::<String>()
})
.collect::<Vec<_>>()
.join("\n")
}
@@ -625,7 +637,10 @@ mod tests {
let s = text(&lines(&view(&st, &lens, &mcp, &log, 80)));
assert!(s.contains("MCP") && s.contains("1/3 up"), "{s}");
assert!(s.contains("git") && s.contains("12 tools"), "{s}");
assert!(s.contains("connection refused") && s.contains("connecting"), "{s}");
assert!(
s.contains("connection refused") && s.contains("connecting"),
"{s}"
);
}
#[test]
@@ -651,12 +666,18 @@ mod tests {
advising: true,
consults: 2,
last: Some((Duration::from_secs(7), Duration::from_secs(27))),
triggers: vec![("before a plan".into(), false), ("before done".into(), true)],
triggers: vec![
("before a plan".into(), false),
("before done".into(), true),
],
};
v.consult = Some(&k);
let s = text(&lines(&v));
assert!(s.contains("CONSULTANT") && s.contains("advising"), "{s}");
assert!(s.contains("● before done") && s.contains("○ before a plan"), "{s}");
assert!(
s.contains("● before done") && s.contains("○ before a plan"),
"{s}"
);
}
#[test]
@@ -667,6 +688,9 @@ mod tests {
let tall = text(&lines(&view(&st, &lens, &[], &log, 80)));
assert!(tall.contains("SESSION LOG"), "{tall}");
let short = text(&lines(&view(&st, &lens, &[], &log, 12)));
assert!(short.contains("MODEL") && !short.contains("SESSION LOG"), "{short}");
assert!(
short.contains("MODEL") && !short.contains("SESSION LOG"),
"{short}"
);
}
}