clippy: zero pedantic warnings across the tree

This commit is contained in:
damocles 2026-05-18 22:09:34 +02:00
parent 690cb5ab5b
commit f9f1346eae
20 changed files with 71 additions and 61 deletions

View file

@ -187,7 +187,7 @@ struct StateSnapshot {
meta_inputs: Vec<MetaInputView>,
}
/// OpQuestion + computed `question_refs` / `answer_refs`. Built
/// `OpQuestion` + computed `question_refs` / `answer_refs`. Built
/// from the snapshot read; the live channel attaches the same
/// fields directly on `QuestionAdded` / `QuestionResolved`.
#[derive(Serialize)]
@ -1207,7 +1207,7 @@ pub(crate) fn emit_meta_inputs_snapshot(coord: &Coordinator) {
/// natural-language text but aren't part of the path itself. Any
/// token starting with `/agents/`, `/shared/`, or
/// `/var/lib/hyperhive/{agents,shared}/` is a candidate. The
/// allow-list + is_file check happens via the same
/// allow-list + `is_file` check happens via the same
/// `resolve_state_path` helper the read endpoint uses, so the
/// security rules can't drift.
pub(crate) fn scan_validated_paths(body: &str) -> Vec<String> {
@ -1222,7 +1222,7 @@ pub(crate) fn scan_validated_paths(body: &str) -> Vec<String> {
// Trim trailing natural-language punctuation that wouldn't
// be part of any real path. Inline rather than via a regex
// dep — the set is small and the call is hot.
let token = raw.trim_end_matches(|c: char| matches!(c, ',' | ';' | ':' | ')' | ']' | '}' | '.' | '\'' | '"'));
let token = raw.trim_end_matches([',', ';', ':', ')', ']', '}', '.', '\'', '"']);
if token.is_empty() {
continue;
}
@ -1265,9 +1265,8 @@ async fn get_state_file(
let body_bytes = if truncated { &bytes[..MAX_BYTES] } else { &bytes[..] };
let mut body = String::from_utf8_lossy(body_bytes).into_owned();
if truncated {
body.push_str(&format!(
"\n\n--- truncated at {MAX_BYTES} of {size} bytes ---\n"
));
use std::fmt::Write as _;
let _ = write!(body, "\n\n--- truncated at {MAX_BYTES} of {size} bytes ---\n");
}
([("content-type", "text/plain; charset=utf-8")], body).into_response()
}
@ -1575,9 +1574,9 @@ where
Fut: std::future::Future<Output = anyhow::Result<()>>,
{
let logical = strip_container_prefix(name);
let _guard = state.coord.transient_guard(&logical, kind);
let guard = state.coord.transient_guard(&logical, kind);
let result = body(logical.clone()).await;
drop(_guard);
drop(guard);
match result {
Ok(()) => {
extra(state, &logical);