fix(agent): gate now binding to logging feature
The Windows CI matrix surfaced an `unused_variables` warning at metrics.rs:846 — `let now = std::time::Instant::now();` was bound unconditionally but only consumed inside a `#[cfg(feature = "logging")]` tracing::debug! call. This block lives in the non-Linux `collect_processes_all`, so the Linux CI never compiles it and never sees the warning. Same shape as the `processes_ttl_ms` Windows fix from earlier: a binding whose only consumer is cfg-gated needs to be cfg-gated too. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -843,6 +843,13 @@ pub async fn collect_processes_all(state: &AppState) -> ProcessesPayload {
|
||||
let cache_cleanup_threshold = name_cache_cleanup_threshold();
|
||||
|
||||
if total_count > proc_cache.names.len() + cache_cleanup_threshold {
|
||||
// `now` is only consumed by the `tracing::debug!` below, so gate
|
||||
// the binding with the same cfg as its consumer. Without this,
|
||||
// a non-logging build (the default) emits an unused-variable
|
||||
// warning. The Linux CI doesn't catch it because this block lives
|
||||
// in the `#[cfg(not(target_os = "linux"))]` collect_processes_all —
|
||||
// the warning only surfaces on the Windows build matrix.
|
||||
#[cfg(feature = "logging")]
|
||||
let now = std::time::Instant::now();
|
||||
proc_cache
|
||||
.names
|
||||
|
||||
Reference in New Issue
Block a user