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