From 500a6c279663a70fd802c6deb2bfef96f15be435 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Kr=C3=BCger?= Date: Thu, 15 Feb 2024 18:32:28 +0100 Subject: [PATCH] refactor: Use `libipld_core::serde::to_ipld` instead of dag-cbor --- wnfs/src/private/keys/access.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/wnfs/src/private/keys/access.rs b/wnfs/src/private/keys/access.rs index 947b03b4..120490c6 100644 --- a/wnfs/src/private/keys/access.rs +++ b/wnfs/src/private/keys/access.rs @@ -124,15 +124,11 @@ impl From<&AccessKey> for Vec { #[cfg(test)] mod snapshot_tests { use super::*; - use libipld_core::ipld::Ipld; use rand::Rng; use rand_chacha::ChaCha12Rng; use rand_core::SeedableRng; use testresult::TestResult; - use wnfs_common::{ - decode, encode, - libipld::{cbor::DagCborCodec, json::DagJsonCodec}, - }; + use wnfs_common::{encode, libipld::json::DagJsonCodec}; #[async_std::test] async fn test_access_key() -> TestResult { @@ -154,9 +150,7 @@ mod snapshot_tests { } fn as_dag_json_value(s: impl Serialize) -> Result { - let dag_cbor = encode(&s, DagCborCodec)?; - let ipld: Ipld = decode(&dag_cbor, DagCborCodec)?; - let dag_json = encode(&ipld, DagJsonCodec)?; + let dag_json = encode(&libipld_core::serde::to_ipld(s)?, DagJsonCodec)?; let value = serde_json::from_slice(&dag_json)?; Ok(value) }