diff --git a/libafl/src/feedbacks/mod.rs b/libafl/src/feedbacks/mod.rs index 2103a894cb..62aa6e5ab2 100644 --- a/libafl/src/feedbacks/mod.rs +++ b/libafl/src/feedbacks/mod.rs @@ -244,6 +244,7 @@ where OT: ObserversTuple; #[cfg(feature = "introspection")] + #[allow(clippy::too_many_arguments)] fn is_pair_interesting_with_perf( first: &mut A, second: &mut B, @@ -499,7 +500,7 @@ where OT: ObserversTuple, { let a = first.is_interesting(state, manager, input, observers, exit_kind)?; - if a == false { + if !a { return Ok(false); } @@ -533,7 +534,7 @@ where feedback_index, )?; - if a == false { + if !a { return Ok(false); } diff --git a/libafl_frida/src/asan_errors.rs b/libafl_frida/src/asan_errors.rs index 5d962d291e..bfa10abdae 100644 --- a/libafl_frida/src/asan_errors.rs +++ b/libafl_frida/src/asan_errors.rs @@ -102,6 +102,7 @@ impl AsanErrors { } /// Get a mutable reference to the global [`AsanErrors`] object + #[must_use] pub fn get_mut<'a>() -> &'a mut Self { unsafe { ASAN_ERRORS.as_mut().unwrap() } } diff --git a/libafl_frida/src/asan_rt.rs b/libafl_frida/src/asan_rt.rs index 94e6c74736..5eea8c94e3 100644 --- a/libafl_frida/src/asan_rt.rs +++ b/libafl_frida/src/asan_rt.rs @@ -174,11 +174,9 @@ impl AsanRuntime { /// real address, the stalked address is returned. #[must_use] pub fn real_address_for_stalked(&self, stalked: usize) -> usize { - if let Some(addr) = self.stalked_addresses.get(&stalked) { - *addr - } else { - stalked - } + self.stalked_addresses + .get(&stalked) + .map_or(stalked, |addr| *addr) } /// Unpoison all the memory that is currently mapped with read/write permissions. diff --git a/libafl_frida/src/cmplog_rt.rs b/libafl_frida/src/cmplog_rt.rs index 8db1f32602..26ee44196b 100644 --- a/libafl_frida/src/cmplog_rt.rs +++ b/libafl_frida/src/cmplog_rt.rs @@ -55,6 +55,7 @@ pub struct CmpLogRuntime { } impl CmpLogRuntime { + #[must_use] pub fn new() -> CmpLogRuntime { Self { regs: [0; 3], @@ -82,7 +83,7 @@ impl CmpLogRuntime { ); let mut k = (retaddr >> 4) ^ (retaddr << 8); - k = k & ((CMPLOG_MAP_W as u64) - 1); + k &= (CMPLOG_MAP_W as u64) - 1; unsafe { libafl_targets_cmplog_wrapper(k, 8, op1, op2); @@ -180,7 +181,14 @@ impl CmpLogRuntime { /// Get the blob which saves the context, jumps to the populate function and restores the context #[inline] + #[must_use] pub fn ops_save_register_and_blr_to_populate(&self) -> &[u8] { self.ops_save_register_and_blr_to_populate.as_ref().unwrap() } } + +impl Default for CmpLogRuntime { + fn default() -> Self { + Self::new() + } +} diff --git a/libafl_frida/src/lib.rs b/libafl_frida/src/lib.rs index 876a8713c1..bf94096f55 100644 --- a/libafl_frida/src/lib.rs +++ b/libafl_frida/src/lib.rs @@ -152,7 +152,8 @@ impl FridaOptions { self.enable_drcov } - /// Is CmpLog enabled? + /// Is `CmpLog` enabled? + #[must_use] #[inline] pub fn cmplog_enabled(&self) -> bool { self.enable_cmplog