Skip to content
Snippets Groups Projects
Commit 03f1f2dc authored by Éloïs's avatar Éloïs
Browse files

[style] comply to latest clippy version

parent d3b02a3a
Branches
No related tags found
1 merge request!1368[feat] bca: add req Identities
...@@ -30,8 +30,7 @@ impl kv_typed::prelude::FromBytes for BlockTxsDbV2 { ...@@ -30,8 +30,7 @@ impl kv_typed::prelude::FromBytes for BlockTxsDbV2 {
type Err = CorruptedBytes; type Err = CorruptedBytes;
fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> { fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> {
Ok(bincode::deserialize(&bytes) bincode::deserialize(&bytes).map_err(|e| CorruptedBytes(format!("{}: '{:?}'", e, bytes)))
.map_err(|e| CorruptedBytes(format!("{}: '{:?}'", e, bytes)))?)
} }
} }
...@@ -44,7 +43,7 @@ impl ToDumpString for BlockTxsDbV2 { ...@@ -44,7 +43,7 @@ impl ToDumpString for BlockTxsDbV2 {
#[cfg(feature = "explorer")] #[cfg(feature = "explorer")]
impl ExplorableValue for BlockTxsDbV2 { impl ExplorableValue for BlockTxsDbV2 {
fn from_explorer_str(source: &str) -> Result<Self, FromExplorerValueErr> { fn from_explorer_str(source: &str) -> Result<Self, FromExplorerValueErr> {
Ok(serde_json::from_str(source).map_err(|e| FromExplorerValueErr(e.into()))?) serde_json::from_str(source).map_err(|e| FromExplorerValueErr(e.into()))
} }
fn to_explorer_json(&self) -> KvResult<serde_json::Value> { fn to_explorer_json(&self) -> KvResult<serde_json::Value> {
serde_json::to_value(self).map_err(|e| KvError::DeserError(e.into())) serde_json::to_value(self).map_err(|e| KvError::DeserError(e.into()))
......
...@@ -40,8 +40,8 @@ impl kv_typed::prelude::FromBytes for UdEntryDbV1 { ...@@ -40,8 +40,8 @@ impl kv_typed::prelude::FromBytes for UdEntryDbV1 {
fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> { fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> {
let json_str = std::str::from_utf8(bytes).expect("corrupted db : invalid utf8 bytes"); let json_str = std::str::from_utf8(bytes).expect("corrupted db : invalid utf8 bytes");
Ok(serde_json::from_str(&json_str) serde_json::from_str(&json_str)
.map_err(|e| CorruptedBytes(format!("{}: '{}'", e, json_str)))?) .map_err(|e| CorruptedBytes(format!("{}: '{}'", e, json_str)))
} }
} }
......
...@@ -121,7 +121,7 @@ impl kv_typed::prelude::FromBytes for BlockUtxosV2Db { ...@@ -121,7 +121,7 @@ impl kv_typed::prelude::FromBytes for BlockUtxosV2Db {
type Err = bincode::Error; type Err = bincode::Error;
fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> { fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> {
Ok(bincode::deserialize(bytes)?) bincode::deserialize(bytes)
} }
} }
...@@ -137,7 +137,7 @@ impl ExplorableValue for BlockUtxosV2Db { ...@@ -137,7 +137,7 @@ impl ExplorableValue for BlockUtxosV2Db {
unimplemented!() unimplemented!()
} }
fn to_explorer_json(&self) -> KvResult<serde_json::Value> { fn to_explorer_json(&self) -> KvResult<serde_json::Value> {
Ok(serde_json::to_value(self).map_err(|e| KvError::DeserError(e.into()))?) serde_json::to_value(self).map_err(|e| KvError::DeserError(e.into()))
} }
} }
......
...@@ -33,8 +33,8 @@ impl kv_typed::prelude::FromBytes for WalletDbV1 { ...@@ -33,8 +33,8 @@ impl kv_typed::prelude::FromBytes for WalletDbV1 {
fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> { fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> {
let json_str = std::str::from_utf8(bytes).expect("corrupted db : invalid utf8 bytes"); let json_str = std::str::from_utf8(bytes).expect("corrupted db : invalid utf8 bytes");
Ok(serde_json::from_str(&json_str) serde_json::from_str(&json_str)
.map_err(|e| CorruptedBytes(format!("{}: '{}'", e, json_str)))?) .map_err(|e| CorruptedBytes(format!("{}: '{}'", e, json_str)))
} }
} }
......
...@@ -47,6 +47,6 @@ impl ExplorableValue for WalletScriptWithSourceAmountV1Db { ...@@ -47,6 +47,6 @@ impl ExplorableValue for WalletScriptWithSourceAmountV1Db {
unimplemented!() unimplemented!()
} }
fn to_explorer_json(&self) -> KvResult<serde_json::Value> { fn to_explorer_json(&self) -> KvResult<serde_json::Value> {
Ok(serde_json::to_value(self).map_err(|e| KvError::DeserError(e.into()))?) serde_json::to_value(self).map_err(|e| KvError::DeserError(e.into()))
} }
} }
...@@ -33,7 +33,7 @@ impl kv_typed::prelude::FromBytes for GvaIdtyDbV1 { ...@@ -33,7 +33,7 @@ impl kv_typed::prelude::FromBytes for GvaIdtyDbV1 {
type Err = bincode::Error; type Err = bincode::Error;
fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> { fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> {
Ok(bincode::deserialize(bytes)?) bincode::deserialize(bytes)
} }
} }
......
...@@ -35,8 +35,7 @@ impl kv_typed::prelude::FromBytes for GvaTxDbV1 { ...@@ -35,8 +35,7 @@ impl kv_typed::prelude::FromBytes for GvaTxDbV1 {
type Err = CorruptedBytes; type Err = CorruptedBytes;
fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> { fn from_bytes(bytes: &[u8]) -> std::result::Result<Self, Self::Err> {
Ok(bincode::deserialize(&bytes) bincode::deserialize(&bytes).map_err(|e| CorruptedBytes(format!("{}: '{:?}'", e, bytes)))
.map_err(|e| CorruptedBytes(format!("{}: '{:?}'", e, bytes)))?)
} }
} }
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
//! Strongly typed key-value storage //! Strongly typed key-value storage
#![allow(clippy::upper_case_acronyms, clippy::from_over_into)]
#![deny( #![deny(
clippy::unwrap_used, clippy::unwrap_used,
missing_copy_implementations, missing_copy_implementations,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment