clippy
This commit is contained in:
parent
c7f1d83b6e
commit
a3b22acb04
@ -1232,10 +1232,9 @@ where
|
||||
.expect("An error occurred when brokering. Exiting.");
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
match sleep_time {
|
||||
Some(time) => thread::sleep(time),
|
||||
None => (),
|
||||
}
|
||||
if let Some(time) = sleep_time {
|
||||
thread::sleep(time)
|
||||
};
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
match sleep_time {
|
||||
@ -1407,10 +1406,9 @@ where
|
||||
|
||||
let map = &mut self.llmp_clients[client_id as usize].current_recv_map;
|
||||
let msg_buf = (*msg).as_slice(map)?;
|
||||
match (on_new_msg)(client_id, (*msg).tag, msg_buf)? {
|
||||
LlmpMsgHookResult::Handled => should_forward_msg = false,
|
||||
_ => (),
|
||||
}
|
||||
if let LlmpMsgHookResult::Handled = (on_new_msg)(client_id, (*msg).tag, msg_buf)? {
|
||||
should_forward_msg = false
|
||||
};
|
||||
if should_forward_msg {
|
||||
self.forward_msg(msg)?;
|
||||
}
|
||||
@ -1574,6 +1572,8 @@ where
|
||||
|
||||
/// The current page could have changed in recv (EOP)
|
||||
/// Alloc the next message, internally handling end of page by allocating a new one.
|
||||
/// # Safety
|
||||
/// Should be safe, but returns an unsafe ptr
|
||||
#[inline]
|
||||
pub unsafe fn alloc_next(&mut self, buf_len: usize) -> Result<*mut LlmpMsg, Error> {
|
||||
self.sender.alloc_next(buf_len)
|
||||
|
@ -35,7 +35,7 @@ where
|
||||
/// Add an entry to the corpus and return its index
|
||||
#[inline]
|
||||
fn add(&mut self, mut testcase: Testcase<I>) -> Result<usize, Error> {
|
||||
if let None = testcase.filename() {
|
||||
if testcase.filename().is_none() {
|
||||
// TODO walk entry metadata to ask for pices of filename (e.g. :havoc in AFL)
|
||||
let filename = self.dir_path.join(format!("id_{}", &self.entries.len()));
|
||||
let filename_str = filename.to_str().expect("Invalid Path");
|
||||
|
@ -328,18 +328,15 @@ where
|
||||
// TODO: Get around local event copy by moving handle_in_client
|
||||
let mut events = vec![];
|
||||
match &mut self.llmp {
|
||||
llmp::LlmpConnection::IsClient { client } => loop {
|
||||
match client.recv_buf()? {
|
||||
Some((sender_id, tag, msg)) => {
|
||||
llmp::LlmpConnection::IsClient { client } => {
|
||||
while let Some((sender_id, tag, msg)) = client.recv_buf()? {
|
||||
if tag == _LLMP_TAG_EVENT_TO_BROKER {
|
||||
continue;
|
||||
}
|
||||
let event: Event<I> = postcard::from_bytes(msg)?;
|
||||
events.push((sender_id, event));
|
||||
}
|
||||
None => break,
|
||||
}
|
||||
},
|
||||
_ => {
|
||||
#[cfg(feature = "std")]
|
||||
dbg!("Skipping process in broker");
|
||||
|
@ -46,7 +46,7 @@ pub fn buffer_self_copy(data: &mut [u8], from: usize, to: usize, len: usize) {
|
||||
debug_assert!(to + len <= data.len());
|
||||
if len != 0 && from != to {
|
||||
let ptr = data.as_mut_ptr();
|
||||
unsafe { core::ptr::copy(ptr.offset(from as isize), ptr.offset(to as isize), len) }
|
||||
unsafe { core::ptr::copy(ptr.add(from), ptr.add(to), len) }
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,13 +60,7 @@ pub fn buffer_copy(dst: &mut [u8], src: &[u8], from: usize, to: usize, len: usiz
|
||||
let dst_ptr = dst.as_mut_ptr();
|
||||
let src_ptr = src.as_ptr();
|
||||
if len != 0 {
|
||||
unsafe {
|
||||
core::ptr::copy(
|
||||
src_ptr.offset(from as isize),
|
||||
dst_ptr.offset(to as isize),
|
||||
len,
|
||||
)
|
||||
}
|
||||
unsafe { core::ptr::copy(src_ptr.add(from), dst_ptr.add(to), len) }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -139,6 +139,17 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<I, R, S> Default for StdScheduledMutator<I, R, S>
|
||||
where
|
||||
I: Input,
|
||||
S: HasRand<R>,
|
||||
R: Rand,
|
||||
{
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
/// Schedule some selected byte level mutations given a ScheduledMutator type
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct HavocBytesMutator<C, I, R, S, SM>
|
||||
|
@ -75,7 +75,7 @@ impl Tokens {
|
||||
let line = line.trim_start().trim_end();
|
||||
|
||||
// we are only interested in '"..."', not prefixed 'foo = '
|
||||
let start = line.chars().nth(0);
|
||||
let start = line.chars().next();
|
||||
if line.is_empty() || start == Some('#') {
|
||||
continue;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user