Fix clippy lints (#1327)

* Fix clippy lints

* Update formatting

* Remove unsafe send impls

* New type for Rc<NodeContainer>
This commit is contained in:
0HyperCube
2023-07-19 16:38:23 +01:00
committed by Keavon Chambers
parent 743803ce04
commit 80cc5bee73
80 changed files with 549 additions and 445 deletions
+3 -2
View File
@@ -1,12 +1,13 @@
//! Basic wrapper for [`serde`] for [`base64`] encoding
use base64::Engine;
use serde::{Deserialize, Deserializer, Serializer};
pub fn as_base64<S>(key: &std::sync::Arc<Vec<u8>>, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
serializer.serialize_str(&base64::encode(key.as_slice()))
serializer.serialize_str(&base64::engine::general_purpose::STANDARD.encode(key.as_slice()))
}
pub fn from_base64<'a, D>(deserializer: D) -> Result<std::sync::Arc<Vec<u8>>, D::Error>
@@ -16,7 +17,7 @@ where
use serde::de::Error;
String::deserialize(deserializer)
.and_then(|string| base64::decode(string).map_err(|err| Error::custom(err.to_string())))
.and_then(|string| base64::engine::general_purpose::STANDARD.decode(string).map_err(|err| Error::custom(err.to_string())))
.map(std::sync::Arc::new)
.map_err(serde::de::Error::custom)
}