Fix all clippy warnings across workspace
collapsible_if, let-chains, derivable_impls, clone_on_copy, useless_vec, approx_constant, io_other_error, single_match, collapsible_match, unnecessary_map_or, manual_is_multiple_of, result_large_err, too_many_arguments, upper_case_acronyms Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -224,10 +224,10 @@ impl CallbackState {
|
||||
|
||||
impl Drop for CallbackState {
|
||||
fn drop(&mut self) {
|
||||
if let Ok(mut relay_task) = self.relay_task.lock() {
|
||||
if let Some(task) = relay_task.take() {
|
||||
task.abort();
|
||||
}
|
||||
if let Ok(mut relay_task) = self.relay_task.lock()
|
||||
&& let Some(task) = relay_task.take()
|
||||
{
|
||||
task.abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,10 +192,10 @@ impl Drop for SessionHandle {
|
||||
fn drop(&mut self) {
|
||||
if Arc::strong_count(&self.inner) == 1 {
|
||||
self.inner.request_close_nonblocking();
|
||||
if let Ok(mut task) = self.inner.task.try_lock() {
|
||||
if let Some(task) = task.take() {
|
||||
task.abort();
|
||||
}
|
||||
if let Ok(mut task) = self.inner.task.try_lock()
|
||||
&& let Some(task) = task.take()
|
||||
{
|
||||
task.abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -304,10 +304,10 @@ impl Session {
|
||||
}
|
||||
Some(SessionCmd::Connect) => {
|
||||
self.desired_connected = true;
|
||||
if self.conn.is_none() {
|
||||
if let Err(err) = self.connect().await {
|
||||
self.emit_error(format!("connect failed: {err}"));
|
||||
}
|
||||
if self.conn.is_none()
|
||||
&& let Err(err) = self.connect().await
|
||||
{
|
||||
self.emit_error(format!("connect failed: {err}"));
|
||||
}
|
||||
true
|
||||
}
|
||||
@@ -500,7 +500,7 @@ async fn try_read(
|
||||
}
|
||||
|
||||
fn to_io_error(err: xserial_core::error::Error) -> std::io::Error {
|
||||
io::Error::new(io::ErrorKind::Other, err.to_string())
|
||||
io::Error::other(err.to_string())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -72,16 +72,13 @@ async fn session_multiple_reads() {
|
||||
let mut texts = Vec::new();
|
||||
tokio::time::timeout(Duration::from_secs(5), async {
|
||||
loop {
|
||||
match rx.recv().await.unwrap() {
|
||||
SessionEvent::Data(_, entry) => {
|
||||
if let DecodedData::Text(s) = entry.data {
|
||||
texts.push(s);
|
||||
if texts.len() == 3 {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if let SessionEvent::Data(_, entry) = rx.recv().await.unwrap()
|
||||
&& let DecodedData::Text(s) = entry.data
|
||||
{
|
||||
texts.push(s);
|
||||
if texts.len() == 3 {
|
||||
break;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -127,14 +124,11 @@ async fn session_multi_pipeline_text_and_hex() {
|
||||
let mut results = Vec::new();
|
||||
tokio::time::timeout(Duration::from_secs(5), async {
|
||||
loop {
|
||||
match rx.recv().await.unwrap() {
|
||||
SessionEvent::Data(_, entry) => {
|
||||
results.push((entry.pipeline_name.clone(), entry.data.clone()));
|
||||
if results.len() == 2 {
|
||||
break;
|
||||
}
|
||||
if let SessionEvent::Data(_, entry) = rx.recv().await.unwrap() {
|
||||
results.push((entry.pipeline_name.clone(), entry.data.clone()));
|
||||
if results.len() == 2 {
|
||||
break;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user