Skip to content

Commit 1569686

Browse files
jaikhurannaclaude
andcommitted
perf(resource-monitor): compile the stat parser only where it is used
Replace the non-Linux dead_code allowance with a cfg, so no lint is suppressed on other platforms. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent bfe4fbf commit 1569686

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎native/resource-monitor/src/main.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ fn process_refresh_kind() -> ProcessRefreshKind {
606606

607607
/// Name and parent pid from `/proc/<pid>/stat`: `pid (comm) state ppid ...`.
608608
/// The name may itself contain spaces and parentheses, so it ends at the last `)`.
609-
#[cfg_attr(not(target_os = "linux"), allow(dead_code))]
609+
#[cfg(any(target_os = "linux", test))]
610610
fn parse_proc_stat(stat: &[u8]) -> Option<(String, u32)> {
611611
let open = stat.iter().position(|&byte| byte == b'(')?;
612612
let close = stat.iter().rposition(|&byte| byte == b')')?;

0 commit comments

Comments
 (0)