Latest fmt (#1339)
This commit is contained in:
parent
07047cb3bb
commit
6f4955619a
@ -45,7 +45,9 @@ fn adder_loop(port: u16) -> Result<(), Box<dyn std::error::Error>> {
|
||||
loop {
|
||||
let mut msg_counter = 0;
|
||||
loop {
|
||||
let Some((sender, tag, buf)) = client.recv_buf()? else { break };
|
||||
let Some((sender, tag, buf)) = client.recv_buf()? else {
|
||||
break;
|
||||
};
|
||||
msg_counter += 1;
|
||||
match tag {
|
||||
_TAG_SIMPLE_U32_V1 => {
|
||||
|
@ -3045,11 +3045,12 @@ where
|
||||
let TcpResponse::BrokerConnectHello {
|
||||
broker_shmem_description,
|
||||
hostname: _,
|
||||
} = recv_tcp_msg(&mut stream)?.try_into()? else {
|
||||
} = recv_tcp_msg(&mut stream)?.try_into()?
|
||||
else {
|
||||
return Err(Error::illegal_state(
|
||||
"Received unexpected Broker Hello".to_string(),
|
||||
));
|
||||
};
|
||||
};
|
||||
|
||||
let map = LlmpSharedMap::existing(
|
||||
shmem_provider.shmem_from_description(broker_shmem_description)?,
|
||||
@ -3064,11 +3065,13 @@ where
|
||||
|
||||
send_tcp_msg(&mut stream, &client_hello_req)?;
|
||||
|
||||
let TcpResponse::LocalClientAccepted { client_id } = recv_tcp_msg(&mut stream)?.try_into()? else {
|
||||
return Err(Error::illegal_state(
|
||||
"Unexpected Response from Broker".to_string(),
|
||||
let TcpResponse::LocalClientAccepted { client_id } =
|
||||
recv_tcp_msg(&mut stream)?.try_into()?
|
||||
else {
|
||||
return Err(Error::illegal_state(
|
||||
"Unexpected Response from Broker".to_string(),
|
||||
));
|
||||
};
|
||||
};
|
||||
|
||||
// Set our ID to the one the broker sent us..
|
||||
// This is mainly so we can filter out our own msgs later.
|
||||
|
@ -353,9 +353,11 @@ impl Drop for ShMemServiceThread {
|
||||
fn drop(&mut self) {
|
||||
if self.join_handle.is_some() {
|
||||
log::info!("Stopping ShMemService");
|
||||
let Ok(mut stream) = UnixStream::connect_to_unix_addr(
|
||||
&UnixSocketAddr::new(UNIX_SERVER_NAME).unwrap(),
|
||||
) else { return };
|
||||
let Ok(mut stream) =
|
||||
UnixStream::connect_to_unix_addr(&UnixSocketAddr::new(UNIX_SERVER_NAME).unwrap())
|
||||
else {
|
||||
return;
|
||||
};
|
||||
|
||||
let body = postcard::to_allocvec(&ServedShMemRequest::Exit).unwrap();
|
||||
|
||||
|
@ -144,7 +144,9 @@ where
|
||||
fn load_input_into(&self, testcase: &mut Testcase<Self::Input>) -> Result<(), Error> {
|
||||
if testcase.input_mut().is_none() {
|
||||
let Some(file_path) = testcase.file_path().as_ref() else {
|
||||
return Err(Error::illegal_argument("No file path set for testcase. Could not load inputs."));
|
||||
return Err(Error::illegal_argument(
|
||||
"No file path set for testcase. Could not load inputs.",
|
||||
));
|
||||
};
|
||||
let input = I::from_file(file_path)?;
|
||||
testcase.set_input(input);
|
||||
@ -155,10 +157,14 @@ where
|
||||
fn store_input_from(&self, testcase: &Testcase<Self::Input>) -> Result<(), Error> {
|
||||
// Store the input to disk
|
||||
let Some(file_path) = testcase.file_path() else {
|
||||
return Err(Error::illegal_argument("No file path set for testcase. Could not store input to disk."));
|
||||
return Err(Error::illegal_argument(
|
||||
"No file path set for testcase. Could not store input to disk.",
|
||||
));
|
||||
};
|
||||
let Some(input) = testcase.input() else {
|
||||
return Err(Error::illegal_argument("No input available for testcase. Could not store anything."));
|
||||
return Err(Error::illegal_argument(
|
||||
"No input available for testcase. Could not store anything.",
|
||||
));
|
||||
};
|
||||
input.to_file(file_path)
|
||||
}
|
||||
|
@ -566,9 +566,9 @@ impl CommandExecutorBuilder {
|
||||
S: UsesInput,
|
||||
{
|
||||
let Some(program) = &self.program else {
|
||||
return Err(Error::illegal_argument(
|
||||
return Err(Error::illegal_argument(
|
||||
"CommandExecutor::builder: no program set!",
|
||||
));
|
||||
));
|
||||
};
|
||||
|
||||
let mut command = Command::new(program);
|
||||
|
@ -330,11 +330,11 @@ impl Forkserver {
|
||||
pub fn read_st_timed(&mut self, timeout: &TimeSpec) -> Result<Option<i32>, Error> {
|
||||
let mut buf: [u8; 4] = [0_u8; 4];
|
||||
let Some(st_read) = self.st_pipe.read_end() else {
|
||||
return Err(Error::file(io::Error::new(
|
||||
ErrorKind::BrokenPipe,
|
||||
"Read pipe end was already closed",
|
||||
)));
|
||||
};
|
||||
return Err(Error::file(io::Error::new(
|
||||
ErrorKind::BrokenPipe,
|
||||
"Read pipe end was already closed",
|
||||
)));
|
||||
};
|
||||
|
||||
let mut readfds = FdSet::new();
|
||||
readfds.insert(st_read);
|
||||
|
@ -169,13 +169,17 @@ impl Tokens {
|
||||
if line.is_empty() || start == Some('#') {
|
||||
continue;
|
||||
}
|
||||
let Some(pos_quote) = line.find('\"') else { return Err(Error::illegal_argument(format!("Illegal line: {line}"))) };
|
||||
let Some(pos_quote) = line.find('\"') else {
|
||||
return Err(Error::illegal_argument(format!("Illegal line: {line}")));
|
||||
};
|
||||
if line.chars().nth(line.len() - 1) != Some('"') {
|
||||
return Err(Error::illegal_argument(format!("Illegal line: {line}")));
|
||||
}
|
||||
|
||||
// extract item
|
||||
let Some(item) = line.get(pos_quote + 1..line.len() - 1) else { return Err(Error::illegal_argument(format!("Illegal line: {line}"))) };
|
||||
let Some(item) = line.get(pos_quote + 1..line.len() - 1) else {
|
||||
return Err(Error::illegal_argument(format!("Illegal line: {line}")));
|
||||
};
|
||||
if item.is_empty() {
|
||||
continue;
|
||||
}
|
||||
|
@ -281,7 +281,9 @@ where
|
||||
/// Cull the `Corpus`
|
||||
#[allow(clippy::unused_self)]
|
||||
pub fn accounting_cull(&self, state: &mut CS::State) -> Result<(), Error> {
|
||||
let Some(top_rated) = state.metadata_map().get::<TopAccountingMetadata>() else { return Ok(()) };
|
||||
let Some(top_rated) = state.metadata_map().get::<TopAccountingMetadata>() else {
|
||||
return Ok(());
|
||||
};
|
||||
|
||||
for (_key, idx) in &top_rated.map {
|
||||
let mut entry = state.corpus().get(*idx)?.borrow_mut();
|
||||
|
@ -322,7 +322,9 @@ where
|
||||
/// Cull the `Corpus` using the `MinimizerScheduler`
|
||||
#[allow(clippy::unused_self)]
|
||||
pub fn cull(&self, state: &mut CS::State) -> Result<(), Error> {
|
||||
let Some(top_rated) = state.metadata_map().get::<TopRatedsMetadata>() else { return Ok(()) };
|
||||
let Some(top_rated) = state.metadata_map().get::<TopRatedsMetadata>() else {
|
||||
return Ok(());
|
||||
};
|
||||
|
||||
let mut acc = HashSet::new();
|
||||
|
||||
|
@ -119,7 +119,9 @@ where
|
||||
|
||||
start_timer!(state);
|
||||
let mut testcase = state.corpus().get(corpus_idx)?.borrow_mut();
|
||||
let Ok(input) = I::try_transform_from(&mut testcase, state, corpus_idx) else { return Ok(()); };
|
||||
let Ok(input) = I::try_transform_from(&mut testcase, state, corpus_idx) else {
|
||||
return Ok(());
|
||||
};
|
||||
drop(testcase);
|
||||
mark_feature_time!(state, PerfFeature::GetInputFromCorpus);
|
||||
|
||||
|
@ -120,7 +120,9 @@ where
|
||||
|
||||
start_timer!(state);
|
||||
let mut testcase = state.corpus().get(corpus_idx)?.borrow_mut();
|
||||
let Ok(input) = I::try_transform_from(&mut testcase, state, corpus_idx) else { return Ok(()); };
|
||||
let Ok(input) = I::try_transform_from(&mut testcase, state, corpus_idx) else {
|
||||
return Ok(());
|
||||
};
|
||||
drop(testcase);
|
||||
mark_feature_time!(state, PerfFeature::GetInputFromCorpus);
|
||||
|
||||
|
@ -351,11 +351,11 @@ impl Allocator {
|
||||
//log::trace!("freeing address: {:?}", ptr);
|
||||
let Some(metadata) = self.allocations.get_mut(&(ptr as usize)) else {
|
||||
if !ptr.is_null() {
|
||||
AsanErrors::get_mut()
|
||||
AsanErrors::get_mut()
|
||||
.report_error(AsanError::UnallocatedFree((ptr as usize, Backtrace::new())));
|
||||
}
|
||||
return;
|
||||
};
|
||||
}
|
||||
return;
|
||||
};
|
||||
|
||||
if metadata.freed {
|
||||
AsanErrors::get_mut().report_error(AsanError::DoubleFree((
|
||||
|
@ -60,15 +60,17 @@ impl NyxHelper {
|
||||
parent_cpu_id: Option<u32>,
|
||||
initial_timeout: Duration,
|
||||
) -> Result<Self, Error> {
|
||||
let Some(sharedir) = target_dir.to_str() else { return Err(Error::illegal_argument("can't convert sharedir to str")) };
|
||||
let Some(sharedir) = target_dir.to_str() else {
|
||||
return Err(Error::illegal_argument("can't convert sharedir to str"));
|
||||
};
|
||||
let work_dir = target_dir.join("workdir");
|
||||
let work_dir = work_dir.to_str().expect("unable to convert workdir to str");
|
||||
let nyx_type = if parallel_mode {
|
||||
let Some(parent_cpu_id) = parent_cpu_id else {
|
||||
return Err(Error::illegal_argument(
|
||||
"please set parent_cpu_id in nyx parallel mode",
|
||||
))
|
||||
};
|
||||
"please set parent_cpu_id in nyx parallel mode",
|
||||
));
|
||||
};
|
||||
if cpu_id == parent_cpu_id {
|
||||
NyxProcessType::PARENT
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user