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;
#[cfg(feature = "introspection")]
#[allow(clippy::too_many_arguments)]
fn is_pair_interesting_with_perf<EM, OT>(
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);
}

View File

@ -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() }
}

View File

@ -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.

View File

@ -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()
}
}

View File

@ -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