chore: drop dead code and the stale wireguard-tools dependency [P2]
wireguard-tools was still declared in Depends and in the runtime package list installed by tools/build.sh --prepare-runtime-env. Since peer discovery moved to docker exec, no code path invokes a host-side wg, and check_host_tools stopped requiring it. The declaration was therefore installing a package the harness never calls and misrepresenting the actual architecture to anyone reading the control file. Removed from both places. Three items were carrying #[allow(dead_code)], which is a way of silencing the compiler about a real question rather than answering it: - SysctlTuningStatus.desired duplicated data that is already in .current - every SysctlValue holds both the desired and the current value, so the second Vec was the same information cloned on every inspect call and read by nobody; - SysctlValue.managed was always set to true and never read. Ownership is decided per file by the marker, not per key, so the field encoded nothing; - unix_now() in the reboot scheduler, along with the SystemTime and UNIX_EPOCH imports it needed. The module works in chrono NaiveDateTime throughout. All three are removed rather than annotated. The workspace now builds clean under -D warnings with no dead_code exceptions anywhere. cargo test --workspace: 158 + 4 passed. clippy -D warnings clean.
This commit is contained in:
@@ -1,10 +1,4 @@
|
||||
use std::{
|
||||
fs,
|
||||
path::PathBuf,
|
||||
process::Command,
|
||||
thread,
|
||||
time::{Duration as StdDuration, SystemTime, UNIX_EPOCH},
|
||||
};
|
||||
use std::{fs, path::PathBuf, process::Command, thread, time::Duration as StdDuration};
|
||||
|
||||
use anyhow::Context;
|
||||
use chrono::{Duration, NaiveDateTime, NaiveTime, Timelike, Utc};
|
||||
@@ -188,14 +182,6 @@ fn parse_hhmm(v: &str) -> anyhow::Result<NaiveTime> {
|
||||
NaiveTime::from_hms_opt(h, m, 0).ok_or_else(|| anyhow::anyhow!("bad time"))
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn unix_now() -> u64 {
|
||||
SystemTime::now()
|
||||
.duration_since(UNIX_EPOCH)
|
||||
.unwrap_or_default()
|
||||
.as_secs()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user