cargo clippy --tests --fix

This commit is contained in:
Nikita Sivukhin
2025-08-06 21:58:52 +04:00
parent 09daa97150
commit ae0dff6a55
3 changed files with 15 additions and 8 deletions

View File

@@ -102,25 +102,25 @@ mod tests {
}
pub async fn connect(&self) -> Result<turso::Connection> {
self.run_db_fn(self.db.as_ref().unwrap(), async move |coro, db| {
Ok(turso::Connection::create(db.connect(&coro).await?))
Ok(turso::Connection::create(db.connect(coro).await?))
})
.await
}
pub async fn pull(&self) -> Result<()> {
self.run_db_fn(self.db.as_ref().unwrap(), async move |coro, db| {
db.pull(&coro).await
db.pull(coro).await
})
.await
}
pub async fn push(&self) -> Result<()> {
self.run_db_fn(self.db.as_ref().unwrap(), async move |coro, db| {
db.push(&coro).await
db.push(coro).await
})
.await
}
pub async fn sync(&self) -> Result<()> {
self.run_db_fn(self.db.as_ref().unwrap(), async move |coro, db| {
db.sync(&coro).await
db.sync(coro).await
})
.await
}

View File

@@ -17,6 +17,7 @@ use crate::{
#[derive(Clone)]
pub struct TestProtocolIo {
#[allow(clippy::type_complexity)]
pub requests: Arc<std::sync::Mutex<Vec<Pin<Box<JoinHandle<()>>>>>>,
pub server: TestSyncServer,
ctx: Arc<TestContext>,
@@ -39,6 +40,12 @@ pub struct TestDataCompletion {
poisoned: Arc<std::sync::Mutex<Option<String>>>,
}
impl Default for TestDataCompletion {
fn default() -> Self {
Self::new()
}
}
impl TestDataCompletion {
pub fn new() -> Self {
Self {
@@ -76,7 +83,7 @@ impl DataCompletion for TestDataCompletion {
"status error: {poison:?}"
)));
}
Ok(self.status.lock().unwrap().clone())
Ok(*self.status.lock().unwrap())
}
fn poll_data(&self) -> Result<Option<Self::HttpPollResult>> {
@@ -87,7 +94,7 @@ impl DataCompletion for TestDataCompletion {
)));
}
let mut chunks = self.chunks.lock().unwrap();
Ok(chunks.pop_front().map(|x| TestDataPollResult(x)))
Ok(chunks.pop_front().map(TestDataPollResult))
}
fn is_done(&self) -> Result<bool> {
@@ -179,7 +186,7 @@ impl ProtocolIO for TestProtocolIo {
.await
});
}
_ => panic!("unexpected sync server request: {} {:?}", method, path),
_ => panic!("unexpected sync server request: {method} {path:?}"),
};
}
Ok(completion)

View File

@@ -213,7 +213,7 @@ impl TestSyncServer {
session.in_txn = true;
}
let frame = &frames[offset..offset + FRAME_SIZE];
match session.conn.wal_insert_frame(frame_no as u64, frame) {
match session.conn.wal_insert_frame(frame_no, frame) {
Ok(info) => {
if info.is_commit_frame() {
if session.in_txn {