fix unused imports

This commit is contained in:
guochao 2024-01-18 21:26:13 +08:00
parent 7fece0efeb
commit e039e4c2bc

View File

@ -1,28 +1,36 @@
#[cfg(feature = "tracing-mode")]
use nix::{
libc::{c_long, EPERM, ORIG_RAX},
sys::stat::Mode,
libc::{c_long, ORIG_RAX},
unistd::{getpid, getppid, Pid},
};
use std::io::Write;
use std::{
ffi::{c_void, CString},
mem::size_of,
};
#[cfg(feature = "tracing-mode")]
use std::{ffi::c_void, io::Write, mem::size_of};
use nix::{libc::EPERM, sys::stat::Mode};
use std::ffi::CString;
use clap::*;
use libseccomp::*;
#[derive(clap::Parser, Debug)]
#[cfg(not(feature = "tracing-mode"))]
#[derive(Parser, Debug)]
struct Args {
#[cfg(feature = "tracing-mode")]
#[clap(short, long)]
log_failed_to: Option<String>,
#[clap(required = true)]
command: Vec<String>,
}
#[cfg(feature = "tracing-mode")]
#[derive(Parser, Debug)]
struct Args {
#[clap(required = true)]
command: Vec<String>,
#[clap(short, long)]
log_failed_to: Option<String>,
}
fn main() -> anyhow::Result<()> {
env_logger::init();
@ -33,7 +41,10 @@ fn main() -> anyhow::Result<()> {
#[cfg(feature = "tracing-mode")]
let tracing = args.log_failed_to != None;
#[cfg(feature = "tracing-mode")]
let mut default_action = ScmpAction::Errno(EPERM);
#[cfg(not(feature = "tracing-mode"))]
let default_action = ScmpAction::Errno(EPERM);
#[cfg(feature = "tracing-mode")]
if let Some(log_fail_to) = args.log_failed_to {