clippy fixes

This commit is contained in:
Dominik Maier 2021-06-07 01:44:07 +02:00
parent f858206ab1
commit 0d0bcc1796
5 changed files with 18 additions and 9 deletions

View File

@ -244,6 +244,7 @@ where
OT: ObserversTuple; OT: ObserversTuple;
#[cfg(feature = "introspection")] #[cfg(feature = "introspection")]
#[allow(clippy::too_many_arguments)]
fn is_pair_interesting_with_perf<EM, OT>( fn is_pair_interesting_with_perf<EM, OT>(
first: &mut A, first: &mut A,
second: &mut B, second: &mut B,
@ -499,7 +500,7 @@ where
OT: ObserversTuple, OT: ObserversTuple,
{ {
let a = first.is_interesting(state, manager, input, observers, exit_kind)?; let a = first.is_interesting(state, manager, input, observers, exit_kind)?;
if a == false { if !a {
return Ok(false); return Ok(false);
} }
@ -533,7 +534,7 @@ where
feedback_index, feedback_index,
)?; )?;
if a == false { if !a {
return Ok(false); return Ok(false);
} }

View File

@ -102,6 +102,7 @@ impl AsanErrors {
} }
/// Get a mutable reference to the global [`AsanErrors`] object /// Get a mutable reference to the global [`AsanErrors`] object
#[must_use]
pub fn get_mut<'a>() -> &'a mut Self { pub fn get_mut<'a>() -> &'a mut Self {
unsafe { ASAN_ERRORS.as_mut().unwrap() } unsafe { ASAN_ERRORS.as_mut().unwrap() }
} }

View File

@ -174,11 +174,9 @@ impl AsanRuntime {
/// real address, the stalked address is returned. /// real address, the stalked address is returned.
#[must_use] #[must_use]
pub fn real_address_for_stalked(&self, stalked: usize) -> usize { pub fn real_address_for_stalked(&self, stalked: usize) -> usize {
if let Some(addr) = self.stalked_addresses.get(&stalked) { self.stalked_addresses
*addr .get(&stalked)
} else { .map_or(stalked, |addr| *addr)
stalked
}
} }
/// Unpoison all the memory that is currently mapped with read/write permissions. /// Unpoison all the memory that is currently mapped with read/write permissions.

View File

@ -55,6 +55,7 @@ pub struct CmpLogRuntime {
} }
impl CmpLogRuntime { impl CmpLogRuntime {
#[must_use]
pub fn new() -> CmpLogRuntime { pub fn new() -> CmpLogRuntime {
Self { Self {
regs: [0; 3], regs: [0; 3],
@ -82,7 +83,7 @@ impl CmpLogRuntime {
); );
let mut k = (retaddr >> 4) ^ (retaddr << 8); let mut k = (retaddr >> 4) ^ (retaddr << 8);
k = k & ((CMPLOG_MAP_W as u64) - 1); k &= (CMPLOG_MAP_W as u64) - 1;
unsafe { unsafe {
libafl_targets_cmplog_wrapper(k, 8, op1, op2); 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 /// Get the blob which saves the context, jumps to the populate function and restores the context
#[inline] #[inline]
#[must_use]
pub fn ops_save_register_and_blr_to_populate(&self) -> &[u8] { pub fn ops_save_register_and_blr_to_populate(&self) -> &[u8] {
self.ops_save_register_and_blr_to_populate.as_ref().unwrap() self.ops_save_register_and_blr_to_populate.as_ref().unwrap()
} }
} }
impl Default for CmpLogRuntime {
fn default() -> Self {
Self::new()
}
}

View File

@ -152,7 +152,8 @@ impl FridaOptions {
self.enable_drcov self.enable_drcov
} }
/// Is CmpLog enabled? /// Is `CmpLog` enabled?
#[must_use]
#[inline] #[inline]
pub fn cmplog_enabled(&self) -> bool { pub fn cmplog_enabled(&self) -> bool {
self.enable_cmplog self.enable_cmplog