Fixing clippy some more (#1872)

* Fixing clippy some more

* more commit

* Git gud

* remove more useless imports
This commit is contained in:
Dominik Maier 2024-02-19 16:46:06 +01:00 committed by GitHub
parent 578a22a3d9
commit fafe8f5ce8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
23 changed files with 20 additions and 33 deletions

View File

@ -4,8 +4,6 @@
use alloc::string::String; use alloc::string::String;
use core::{ use core::{
cell::{Ref, RefMut}, cell::{Ref, RefMut},
default::Default,
option::Option,
time::Duration, time::Duration,
}; };
#[cfg(feature = "std")] #[cfg(feature = "std")]

View File

@ -6,7 +6,6 @@ use std::fs::create_dir_all;
use grammartec::{chunkstore::ChunkStore, context::Context}; use grammartec::{chunkstore::ChunkStore, context::Context};
use libafl_bolts::Named; use libafl_bolts::Named;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_json;
use crate::{ use crate::{
corpus::{Corpus, Testcase}, corpus::{Corpus, Testcase},

View File

@ -4,7 +4,6 @@
use alloc::{borrow::ToOwned, rc::Rc, string::String, vec::Vec}; use alloc::{borrow::ToOwned, rc::Rc, string::String, vec::Vec};
use core::{ use core::{
cell::RefCell, cell::RefCell,
convert::From,
hash::{BuildHasher, Hasher}, hash::{BuildHasher, Hasher},
}; };
#[cfg(feature = "std")] #[cfg(feature = "std")]

View File

@ -9,7 +9,6 @@ use alloc::{borrow::ToOwned, rc::Rc, string::String, vec::Vec};
use core::str::from_utf8; use core::str::from_utf8;
use core::{ use core::{
cell::RefCell, cell::RefCell,
convert::From,
hash::{BuildHasher, Hasher}, hash::{BuildHasher, Hasher},
}; };

View File

@ -2,7 +2,6 @@
use alloc::{rc::Rc, string::String, vec::Vec}; use alloc::{rc::Rc, string::String, vec::Vec};
use core::{ use core::{
cell::RefCell, cell::RefCell,
convert::From,
hash::{BuildHasher, Hasher}, hash::{BuildHasher, Hasher},
}; };

View File

@ -5,7 +5,7 @@
//use core::hash::Hasher; //use core::hash::Hasher;
use alloc::{rc::Rc, string::String, vec::Vec}; use alloc::{rc::Rc, string::String, vec::Vec};
use core::{cell::RefCell, convert::From}; use core::cell::RefCell;
use std::hash::{Hash, Hasher}; use std::hash::{Hash, Hasher};
use grammartec::{ use grammartec::{

View File

@ -22,7 +22,7 @@ use crossterm::{
use hashbrown::HashMap; use hashbrown::HashMap;
use libafl_bolts::{current_time, format_duration_hms, ClientId}; use libafl_bolts::{current_time, format_duration_hms, ClientId};
use ratatui::{backend::CrosstermBackend, Terminal}; use ratatui::{backend::CrosstermBackend, Terminal};
use serde_json::{self, Value}; use serde_json::Value;
#[cfg(feature = "introspection")] #[cfg(feature = "introspection")]
use super::{ClientPerfMonitor, PerfFeature}; use super::{ClientPerfMonitor, PerfFeature};

View File

@ -1401,7 +1401,7 @@ mod tests {
use super::*; use super::*;
use crate::{ use crate::{
corpus::{Corpus, InMemoryCorpus}, corpus::InMemoryCorpus,
feedbacks::ConstFeedback, feedbacks::ConstFeedback,
inputs::BytesInput, inputs::BytesInput,
mutators::MutatorsTuple, mutators::MutatorsTuple,

View File

@ -520,10 +520,15 @@ where
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use libafl_bolts::rands::StdRand; use libafl_bolts::{rands::StdRand, Error};
use super::*; use crate::{
use crate::{corpus::NopCorpus, stages::extract_metadata, state::StdState}; corpus::NopCorpus,
inputs::{BytesInput, HasBytesVec},
mutators::{Mutator, StringCategoryRandMutator, StringSubcategoryRandMutator},
stages::extract_metadata,
state::StdState,
};
// a not-so-useful test for this // a not-so-useful test for this
#[test] #[test]

View File

@ -4,7 +4,7 @@ A well-known [`Stage`], for example, is the mutational stage, running multiple [
Other stages may enrich [`crate::corpus::Testcase`]s with metadata. Other stages may enrich [`crate::corpus::Testcase`]s with metadata.
*/ */
use core::{convert::From, marker::PhantomData}; use core::marker::PhantomData;
pub use calibrate::CalibrationStage; pub use calibrate::CalibrationStage;
pub use colorization::*; pub use colorization::*;

View File

@ -365,9 +365,6 @@ pub fn parse_args() -> FuzzerOptions {
any(feature = "cli", feature = "qemu_cli", feature = "frida_cli") any(feature = "cli", feature = "qemu_cli", feature = "frida_cli")
))] ))]
mod tests { mod tests {
#[cfg(feature = "frida_cli")]
use alloc::string::String;
use super::*; use super::*;
/// pass a standard option and `--` followed by some options that `FuzzerOptions` doesn't know /// pass a standard option and `--` followed by some options that `FuzzerOptions` doesn't know

View File

@ -211,7 +211,6 @@ pub mod launcher {}
use core::{ use core::{
array::TryFromSliceError, array::TryFromSliceError,
fmt::{self, Display}, fmt::{self, Display},
iter::Iterator,
num::{ParseIntError, TryFromIntError}, num::{ParseIntError, TryFromIntError},
time, time,
}; };

View File

@ -2,7 +2,7 @@
use core::{debug_assert, fmt::Debug}; use core::{debug_assert, fmt::Debug};
#[cfg(feature = "rand_trait")] #[cfg(feature = "rand_trait")]
use rand_core::{self, impls::fill_bytes_via_next, RngCore}; use rand_core::{impls::fill_bytes_via_next, RngCore};
use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde::{de::DeserializeOwned, Deserialize, Serialize};
#[cfg(feature = "std")] #[cfg(feature = "std")]

View File

@ -73,7 +73,6 @@ pub mod serdeany_registry {
hash_map::{Keys, Values, ValuesMut}, hash_map::{Keys, Values, ValuesMut},
HashMap, HashMap,
}; };
use postcard;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::{ use crate::{

View File

@ -1,7 +1,7 @@
//! Ar Wrapper from `LibAFL` //! Ar Wrapper from `LibAFL`
// pass to e.g. cmake with -DCMAKE_AR=/path/to/fuzzer/target/release/libafl_ar // pass to e.g. cmake with -DCMAKE_AR=/path/to/fuzzer/target/release/libafl_ar
use std::{convert::Into, env, path::PathBuf, str::FromStr, string::String, vec::Vec}; use std::{env, path::PathBuf, str::FromStr};
use crate::{Error, ToolWrapper, LIB_EXT, LIB_PREFIX}; use crate::{Error, ToolWrapper, LIB_EXT, LIB_PREFIX};

View File

@ -1,12 +1,9 @@
//! LLVM compiler Wrapper from `LibAFL` //! LLVM compiler Wrapper from `LibAFL`
use std::{ use std::{
convert::Into,
env, env,
path::{Path, PathBuf}, path::{Path, PathBuf},
str::FromStr, str::FromStr,
string::String,
vec::Vec,
}; };
use crate::{CompilerWrapper, Error, ToolWrapper, LIB_EXT, LIB_PREFIX}; use crate::{CompilerWrapper, Error, ToolWrapper, LIB_EXT, LIB_PREFIX};

View File

@ -57,7 +57,7 @@
) )
)] )]
use std::{convert::Into, path::Path, process::Command, string::String, vec::Vec}; use std::{path::Path, process::Command};
pub mod ar; pub mod ar;
pub use ar::ArWrapper; pub use ar::ArWrapper;

View File

@ -1,7 +1,7 @@
//! Libtool Wrapper from `LibAFL` //! Libtool Wrapper from `LibAFL`
// call make passing LIBTOOL=/path/to/target/release/libafl_libtool // call make passing LIBTOOL=/path/to/target/release/libafl_libtool
use std::{convert::Into, env, path::PathBuf, str::FromStr, string::String, vec::Vec}; use std::{env, path::PathBuf, str::FromStr};
use crate::{Error, ToolWrapper, LIB_EXT, LIB_PREFIX}; use crate::{Error, ToolWrapper, LIB_EXT, LIB_PREFIX};

View File

@ -8,10 +8,9 @@ use std::{
io::{BufWriter, Write}, io::{BufWriter, Write},
path::PathBuf, path::PathBuf,
process::{exit, Command}, process::{exit, Command},
string::ToString,
}; };
use clap::{self, Parser}; use clap::Parser;
use libafl::observers::concolic::{ use libafl::observers::concolic::{
serialization_format::{MessageFileReader, MessageFileWriter, DEFAULT_ENV_NAME}, serialization_format::{MessageFileReader, MessageFileWriter, DEFAULT_ENV_NAME},
EXPRESSION_PRUNING, HITMAP_ENV_NAME, NO_FLOAT_ENV_NAME, SELECTIVE_SYMBOLICATION_ENV_NAME, EXPRESSION_PRUNING, HITMAP_ENV_NAME, NO_FLOAT_ENV_NAME, SELECTIVE_SYMBOLICATION_ENV_NAME,

View File

@ -14,7 +14,7 @@ use libafl::{
inputs::{HasTargetBytes, Input}, inputs::{HasTargetBytes, Input},
Error, Error,
}; };
use libafl_targets::{self, CMPLOG_MAP_W}; use libafl_targets::CMPLOG_MAP_W;
use rangemap::RangeMap; use rangemap::RangeMap;
use crate::helper::FridaRuntime; use crate::helper::FridaRuntime;

View File

@ -1,6 +1,6 @@
//! Utilities to parse and process ELFs //! Utilities to parse and process ELFs
use std::{convert::AsRef, fs::File, io::Read, ops::Range, path::Path, str}; use std::{fs::File, io::Read, ops::Range, path::Path, str};
use goblin::elf::{header::ET_DYN, Elf}; use goblin::elf::{header::ET_DYN, Elf};
use libafl::Error; use libafl::Error;

View File

@ -1,7 +1,6 @@
//! Expose QEMU user `LibAFL` C api to Rust //! Expose QEMU user `LibAFL` C api to Rust
use core::{ use core::{
convert::Into,
ffi::c_void, ffi::c_void,
fmt, fmt,
mem::{transmute, MaybeUninit}, mem::{transmute, MaybeUninit},
@ -1763,8 +1762,6 @@ impl ArchExtras for Emulator {
#[cfg(feature = "python")] #[cfg(feature = "python")]
pub mod pybind { pub mod pybind {
use std::convert::TryFrom;
use pyo3::{exceptions::PyValueError, prelude::*, types::PyInt}; use pyo3::{exceptions::PyValueError, prelude::*, types::PyInt};
use super::{GuestAddr, GuestUsize, MmapPerms, SyscallHookResult}; use super::{GuestAddr, GuestUsize, MmapPerms, SyscallHookResult};

View File

@ -7,7 +7,7 @@ use std::{
sync::OnceLock, sync::OnceLock,
}; };
use clap::{self, Parser}; use clap::Parser;
use libafl::generators::gramatron::{Automaton, Trigger}; use libafl::generators::gramatron::{Automaton, Trigger};
use regex::Regex; use regex::Regex;
use serde_json::Value; use serde_json::Value;