Skip to content

Commit

Permalink
chore: Don't require futures to be Sync
Browse files Browse the repository at this point in the history
  • Loading branch information
matheus23 committed Jan 1, 2024
1 parent 7310ed2 commit d0d29e3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
15 changes: 9 additions & 6 deletions car-mirror/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,26 +472,29 @@ impl Default for Config {

#[cfg(test)]
mod tests {
use wnfs_common::MemoryBlockStore;

use super::*;
use crate::test_utils::assert_cond_send_sync;
use crate::{test_utils::assert_cond_send_sync, traits::NoCache};

fn send_sync_tests() {
#[allow(clippy::unreachable, unused)]
fn test_assert_send() {
assert_cond_send_sync(|| {
block_send(
unimplemented!(),
unimplemented!(),
unimplemented!(),
unimplemented!(),
unimplemented!(),
unimplemented!() as &MemoryBlockStore,
&NoCache,
)
});
assert_cond_send_sync(|| {
block_receive(
unimplemented!(),
unimplemented!(),
unimplemented!(),
unimplemented!(),
unimplemented!(),
unimplemented!() as &MemoryBlockStore,
&NoCache,
)
})
}
Expand Down
4 changes: 2 additions & 2 deletions car-mirror/src/test_utils/local_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use anyhow::Result;
use futures::TryStreamExt;
use libipld::{Cid, Ipld};
use proptest::strategy::Strategy;
use wnfs_common::{utils::CondSync, BlockStore, MemoryBlockStore};
use wnfs_common::{utils::CondSend, BlockStore, MemoryBlockStore};

#[derive(Clone, Debug)]
pub(crate) struct Metrics {
Expand Down Expand Up @@ -92,4 +92,4 @@ pub(crate) async fn total_dag_blocks(root: Cid, store: &impl BlockStore) -> Resu
.len())
}

pub(crate) fn assert_cond_send_sync<T: CondSync>(fut: fn() -> T) {}
pub(crate) fn assert_cond_send_sync<T: CondSend>(_fut: fn() -> T) {}

0 comments on commit d0d29e3

Please sign in to comment.