Skip to content

Commit aa63fa3

Browse files
committed
fix: clippy
1 parent 6e58d7a commit aa63fa3

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

crates/libs/kill_tree/src/macos/mod.rs renamed to crates/libs/kill_tree/src/macos.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
mod libproc;
2-
31
use crate::{
42
common::{self, Impl, ProcessInfo, ProcessInfos},
53
ProcessId,
@@ -15,7 +13,13 @@ const AVAILABLE_MAX_PROCESS_ID: u32 = 99999 - 1;
1513

1614
#[instrument]
1715
pub(crate) async fn get_process_info(process_id: ProcessId) -> Option<ProcessInfo> {
18-
let proc_bsdinfo_size = std::mem::size_of::<libproc::proc_bsdinfo>() as u32;
16+
let proc_bsdinfo_size = match u32::try_from(std::mem::size_of::<libproc::proc_bsdinfo>()) {
17+
Ok(x) => x,
18+
Err(e) => {
19+
debug!(error = ?e, "failed to convert size of proc_bsdinfo");
20+
return None;
21+
}
22+
};
1923
let mut proc_bsdinfo = unsafe { std::mem::zeroed::<libproc::proc_bsdinfo>() };
2024
let result = unsafe {
2125
libproc::proc_pidinfo(
@@ -106,3 +110,9 @@ mod tests {
106110
);
107111
}
108112
}
113+
114+
#[allow(warnings)]
115+
#[allow(clippy::pedantic)]
116+
mod libproc {
117+
include!(concat!(env!("OUT_DIR"), "/libproc_bindings.rs"));
118+
}

crates/libs/kill_tree/src/macos/libproc.rs

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)