fix(tt4): drop the dead pid helper so e2e_pty is warning-free off Linux
`rss_kib` is Linux-only (#[cfg(target_os = "linux")]) and was the sole caller of `pid()`, so on macOS/Windows `pid` was dead code and emitted a `method `pid` is never used` warning. The Linux CI clippy gate never saw it — `pid` is used on Linux — so it only surfaced on a manual macOS run. Read `child.process_id()` inline in `rss_kib` and delete the helper. Verified: macOS `cargo test` is fully green (5 e2e_pty tests there; the Linux-only RSS test is cfg'd out). clippy --all-targets + fmt clean.
This commit is contained in:
+5
-6
@@ -233,14 +233,13 @@ impl PtyApp {
|
|||||||
self.send(b"\r");
|
self.send(b"\r");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn pid(&self) -> Option<u32> {
|
/// Resident set size of the child in KiB (Linux only). `process_id`
|
||||||
self.child.process_id()
|
/// is read inline here rather than via a helper so the method has no
|
||||||
}
|
/// non-Linux callers to go dead (the CI clippy gate runs on Linux,
|
||||||
|
/// where such dead code wouldn't surface).
|
||||||
/// Resident set size of the child in KiB (Linux only).
|
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
fn rss_kib(&self) -> Option<u64> {
|
fn rss_kib(&self) -> Option<u64> {
|
||||||
let pid = self.pid()?;
|
let pid = self.child.process_id()?;
|
||||||
let status = std::fs::read_to_string(format!("/proc/{pid}/status")).ok()?;
|
let status = std::fs::read_to_string(format!("/proc/{pid}/status")).ok()?;
|
||||||
status.lines().find_map(|l| {
|
status.lines().find_map(|l| {
|
||||||
let rest = l.strip_prefix("VmRSS:")?;
|
let rest = l.strip_prefix("VmRSS:")?;
|
||||||
|
|||||||
Reference in New Issue
Block a user