fix(#1375): clean up pedantic warnings and re-enable -D warnings without pedantic bypass
This commit is contained in:
parent
da7f1d6c45
commit
fb726197ea
28 changed files with 109 additions and 90 deletions
|
|
@ -65,7 +65,8 @@ fn format_task(id: &str, task: &serde_json::Value) -> String {
|
|||
let now = std::time::SystemTime::now()
|
||||
.duration_since(std::time::UNIX_EPOCH)
|
||||
.unwrap_or_default()
|
||||
.as_secs() as i64;
|
||||
.as_secs()
|
||||
.cast_signed();
|
||||
let _ = write!(out, ", running for {}s", now - started);
|
||||
}
|
||||
if let (Some(completed), Some(started)) =
|
||||
|
|
@ -76,8 +77,8 @@ fn format_task(id: &str, task: &serde_json::Value) -> String {
|
|||
|
||||
let out_file = paths::task_out(id);
|
||||
let err_file = paths::task_err(id);
|
||||
let out_len = std::fs::metadata(&out_file).map(|m| m.len()).unwrap_or(0);
|
||||
let err_len = std::fs::metadata(&err_file).map(|m| m.len()).unwrap_or(0);
|
||||
let out_len = std::fs::metadata(&out_file).map_or(0, |m| m.len());
|
||||
let err_len = std::fs::metadata(&err_file).map_or(0, |m| m.len());
|
||||
|
||||
if let Some(stdout) = task["stdout_tail"].as_str() {
|
||||
let s = stdout.trim();
|
||||
|
|
@ -151,6 +152,7 @@ struct BashRunArgs {
|
|||
wait_seconds: Option<u64>,
|
||||
}
|
||||
|
||||
#[allow(clippy::unnecessary_wraps)]
|
||||
fn default_wait() -> Option<u64> {
|
||||
Some(3)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,8 +33,7 @@ pub fn tasks_dir() -> PathBuf {
|
|||
let state_path = PathBuf::from(&state);
|
||||
state_path
|
||||
.parent()
|
||||
.map(|p| p.join("harness"))
|
||||
.unwrap_or_else(|| PathBuf::from(state))
|
||||
.map_or_else(|| PathBuf::from(state), |p| p.join("harness"))
|
||||
};
|
||||
base.join("bash-tasks")
|
||||
}
|
||||
|
|
@ -64,8 +63,7 @@ pub fn mcp_loose_ends_dir() -> PathBuf {
|
|||
let state_path = PathBuf::from(&state);
|
||||
state_path
|
||||
.parent()
|
||||
.map(|p| p.join("harness"))
|
||||
.unwrap_or_else(|| PathBuf::from(state))
|
||||
.map_or_else(|| PathBuf::from(state), |p| p.join("harness"))
|
||||
};
|
||||
base.join("mcp-loose-ends")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,8 @@ fn now_unix() -> i64 {
|
|||
SystemTime::now()
|
||||
.duration_since(UNIX_EPOCH)
|
||||
.unwrap_or_default()
|
||||
.as_secs() as i64
|
||||
.as_secs()
|
||||
.cast_signed()
|
||||
}
|
||||
|
||||
/// Generate a task ID: `<timestamp_hex><seq_hex>`.
|
||||
|
|
@ -112,7 +113,7 @@ fn refresh_loose_ends() {
|
|||
let dest = dir.join("bash.json");
|
||||
let tmp = dest.with_extension("json.tmp");
|
||||
let json = serde_json::to_string(&items).unwrap_or_else(|_| "[]".to_owned());
|
||||
if let Err(e) = std::fs::write(&tmp, &json).and_then(|_| std::fs::rename(&tmp, &dest)) {
|
||||
if let Err(e) = std::fs::write(&tmp, &json).and_then(|()| std::fs::rename(&tmp, &dest)) {
|
||||
tracing::warn!(error = ?e, "bash_runner: write mcp-loose-ends/bash.json failed");
|
||||
}
|
||||
}
|
||||
|
|
@ -220,7 +221,7 @@ async fn run_loop(socket: PathBuf) {
|
|||
let claimed: Arc<Mutex<HashSet<String>>> = Arc::new(Mutex::new(HashSet::new()));
|
||||
|
||||
loop {
|
||||
poll_once(&socket, &claimed).await;
|
||||
poll_once(&socket, &claimed);
|
||||
tokio::time::sleep(POLL_INTERVAL).await;
|
||||
}
|
||||
}
|
||||
|
|
@ -255,7 +256,7 @@ async fn mark_interrupted(socket: &Path) {
|
|||
}
|
||||
}
|
||||
|
||||
async fn poll_once(socket: &Path, claimed: &Arc<Mutex<HashSet<String>>>) {
|
||||
fn poll_once(socket: &Path, claimed: &Arc<Mutex<HashSet<String>>>) {
|
||||
let Ok(rd) = std::fs::read_dir(paths::tasks_dir()) else {
|
||||
return;
|
||||
};
|
||||
|
|
@ -452,6 +453,8 @@ pub(crate) async fn send_wake(
|
|||
summary: &str,
|
||||
output: Option<(&str, &str)>,
|
||||
) {
|
||||
use tokio::io::{AsyncBufReadExt as _, BufReader};
|
||||
use tokio::net::UnixStream;
|
||||
let mut body = format!("bash task `{id}` finished: {summary}");
|
||||
if let Some((stdout, stderr)) = output {
|
||||
if !stdout.is_empty() {
|
||||
|
|
@ -471,9 +474,6 @@ pub(crate) async fn send_wake(
|
|||
transient: true,
|
||||
};
|
||||
|
||||
use tokio::io::{AsyncBufReadExt as _, BufReader};
|
||||
use tokio::net::UnixStream;
|
||||
|
||||
match UnixStream::connect(socket).await {
|
||||
Ok(stream) => {
|
||||
let (read, mut write) = stream.into_split();
|
||||
|
|
|
|||
Loading…
Reference in a new issue