From eb70c8025b3a9d65060c8ea39bd4ed0258d8c1cc Mon Sep 17 00:00:00 2001 From: Dominik Maier Date: Sat, 7 May 2022 15:35:37 +0200 Subject: [PATCH] Clippy nightly fixes (#624) --- libafl/src/bolts/launcher.rs | 2 +- libafl/src/bolts/serdeany.rs | 2 +- libafl/src/events/simple.rs | 2 +- libafl/src/lib.rs | 3 +++ libafl/src/monitors/multi.rs | 4 ++-- libafl/src/monitors/tui/mod.rs | 3 ++- libafl/src/mutators/token_mutations.rs | 2 +- libafl/src/observers/map.rs | 4 ++-- 8 files changed, 13 insertions(+), 9 deletions(-) diff --git a/libafl/src/bolts/launcher.rs b/libafl/src/bolts/launcher.rs index 3c065f25d3..fbfd5b38d6 100644 --- a/libafl/src/bolts/launcher.rs +++ b/libafl/src/bolts/launcher.rs @@ -86,7 +86,7 @@ where phantom_data: PhantomData<(&'a I, &'a OT, &'a S, &'a SP)>, } -impl<'a, CF, I, MT, OT, S, SP> Debug for Launcher<'_, CF, I, MT, OT, S, SP> +impl Debug for Launcher<'_, CF, I, MT, OT, S, SP> where CF: FnOnce(Option, LlmpRestartingEventManager, usize) -> Result<(), Error>, I: Input, diff --git a/libafl/src/bolts/serdeany.rs b/libafl/src/bolts/serdeany.rs index 303c36c80a..ca0032d12f 100644 --- a/libafl/src/bolts/serdeany.rs +++ b/libafl/src/bolts/serdeany.rs @@ -560,7 +560,7 @@ macro_rules! create_serde_registry_for_trait { } #[allow(unused_qualifications)] - impl<'a> Serialize for dyn $trait_name { + impl Serialize for dyn $trait_name { fn serialize(&self, se: S) -> Result where S: Serializer, diff --git a/libafl/src/events/simple.rs b/libafl/src/events/simple.rs index b46aeb2873..0d1a9b895d 100644 --- a/libafl/src/events/simple.rs +++ b/libafl/src/events/simple.rs @@ -307,7 +307,7 @@ where #[cfg(feature = "std")] #[allow(clippy::type_complexity, clippy::too_many_lines)] -impl<'a, I, MT, SP> SimpleRestartingEventManager +impl SimpleRestartingEventManager where I: Input, SP: ShMemProvider, diff --git a/libafl/src/lib.rs b/libafl/src/lib.rs index 09c1c5d70f..7fa263422c 100644 --- a/libafl/src/lib.rs +++ b/libafl/src/lib.rs @@ -43,6 +43,8 @@ Welcome to `LibAFL` unused_extern_crates, unused_import_braces, unused_qualifications, + unused_must_use, + missing_docs, //unused_results ))] #![cfg_attr( @@ -106,6 +108,7 @@ pub use fuzzer::*; use std::{env::VarError, io}; #[cfg(feature = "errors_backtrace")] +/// Error Backtrace type when `errors_backtrace` feature is enabled (== [`backtrace::Backtrace`]) pub type ErrorBacktrace = backtrace::Backtrace; #[cfg(not(feature = "errors_backtrace"))] diff --git a/libafl/src/monitors/multi.rs b/libafl/src/monitors/multi.rs index 491bf694f0..eaa7768069 100644 --- a/libafl/src/monitors/multi.rs +++ b/libafl/src/monitors/multi.rs @@ -1,7 +1,7 @@ //! Monitor to display both cumulative and per-client monitor use alloc::{string::String, vec::Vec}; -use core::time::Duration; +use core::{fmt::Write, time::Duration}; #[cfg(feature = "introspection")] use alloc::string::ToString; @@ -71,7 +71,7 @@ where pad, client.corpus_size, client.objective_size, client.executions, exec_sec ); for (key, val) in &client.user_monitor { - fmt += &format!(", {}: {}", key, val); + write!(fmt, ", {}: {}", key, val).unwrap(); } (self.print_fn)(fmt); diff --git a/libafl/src/monitors/tui/mod.rs b/libafl/src/monitors/tui/mod.rs index c88e80f00c..eb3c5eb13e 100644 --- a/libafl/src/monitors/tui/mod.rs +++ b/libafl/src/monitors/tui/mod.rs @@ -10,6 +10,7 @@ use tui::{backend::CrosstermBackend, Terminal}; use std::{ collections::VecDeque, + fmt::Write, io::{self, BufRead}, string::String, sync::{Arc, RwLock}, @@ -285,7 +286,7 @@ impl Monitor for TuiMonitor { head, client.corpus_size, client.objective_size, client.executions, exec_sec ); for (key, val) in &client.user_monitor { - fmt += &format!(", {}: {}", key, val); + write!(fmt, ", {}: {}", key, val).unwrap(); } { diff --git a/libafl/src/mutators/token_mutations.rs b/libafl/src/mutators/token_mutations.rs index 3071cdfadf..68e907ed58 100644 --- a/libafl/src/mutators/token_mutations.rs +++ b/libafl/src/mutators/token_mutations.rs @@ -280,7 +280,7 @@ impl Add for &Tokens { } } -impl<'a, 'it> IntoIterator for &'it Tokens { +impl<'it> IntoIterator for &'it Tokens { type Item = > as Iterator>::Item; type IntoIter = Iter<'it, Vec>; diff --git a/libafl/src/observers/map.rs b/libafl/src/observers/map.rs index 8034a5ee3c..9f5a172f32 100644 --- a/libafl/src/observers/map.rs +++ b/libafl/src/observers/map.rs @@ -1351,7 +1351,7 @@ where } } -impl<'a, 'it, T> AsRefIterator<'it> for OwnedMapObserver +impl<'it, T> AsRefIterator<'it> for OwnedMapObserver where T: Default + Copy + 'static + Serialize + serde::de::DeserializeOwned + Debug, { @@ -1363,7 +1363,7 @@ where } } -impl<'a, 'it, T> AsMutIterator<'it> for OwnedMapObserver +impl<'it, T> AsMutIterator<'it> for OwnedMapObserver where T: Default + Copy + 'static + Serialize + serde::de::DeserializeOwned + Debug, {