From 6a1600d432146c569d72d2dc17299d6425b418bc Mon Sep 17 00:00:00 2001 From: Albert24GG Date: Wed, 6 Mar 2024 10:34:47 +0200 Subject: [PATCH] Solve `unused imports` warning --- src/os/module.rs | 12 ++++++------ src/os/process.rs | 7 +++++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/os/module.rs b/src/os/module.rs index fc2e91d..2cc4ec5 100644 --- a/src/os/module.rs +++ b/src/os/module.rs @@ -1,13 +1,13 @@ use anyhow::Result; -use goblin::pe::export::Export; -use goblin::pe::import::Import; -use goblin::pe::options::ParseOptions; -use goblin::pe::section_table::SectionTable; -use goblin::pe::PE; +#[cfg(target_os = "windows")] +use goblin::pe::{ + export::Export, import::Import, options::ParseOptions, section_table::SectionTable, PE, +}; #[cfg(target_os = "linux")] -use goblin::elf::{program_header, sym, Elf, SectionHeader}; +use goblin::elf::{sym, Elf, SectionHeader}; +#[cfg(target_os = "linux")] use std::path::PathBuf; #[cfg(target_os = "linux")] diff --git a/src/os/process.rs b/src/os/process.rs index 710268d..2c9607c 100644 --- a/src/os/process.rs +++ b/src/os/process.rs @@ -5,10 +5,13 @@ use super::ModuleEntry; use anyhow::{bail, Result}; use std::collections::HashMap; -use std::ffi::{c_void, CStr}; +use std::ffi::c_void; use std::mem; -use std::ptr; +#[cfg(target_os = "windows")] +use std::ffi::CStr; +#[cfg(target_os = "windows")] +use std::ptr; #[cfg(target_os = "windows")] use windows::Win32::{ Foundation::{CloseHandle, HANDLE},