From 5889ad77a33fb9f5b289118be0f4d60f7fcbe9e4 Mon Sep 17 00:00:00 2001 From: DieMyst Date: Wed, 10 Feb 2021 15:26:26 +0300 Subject: [PATCH] fmt --- bin/src/main.rs | 4 ++-- bin/src/proxy_structs.rs | 14 +++++--------- bin/src/results.rs | 8 ++++---- bin/src/service_api.rs | 9 +++++---- 4 files changed, 16 insertions(+), 19 deletions(-) diff --git a/bin/src/main.rs b/bin/src/main.rs index a899667..6152877 100644 --- a/bin/src/main.rs +++ b/bin/src/main.rs @@ -1,9 +1,9 @@ use fluence::WasmLoggerBuilder; +mod proxy_structs; +mod results; mod service_api; mod storage_impl; -mod results; -mod proxy_structs; pub fn main() { WasmLoggerBuilder::new() diff --git a/bin/src/proxy_structs.rs b/bin/src/proxy_structs.rs index e12a4aa..9178854 100644 --- a/bin/src/proxy_structs.rs +++ b/bin/src/proxy_structs.rs @@ -1,5 +1,5 @@ -use trust_graph::{Trust as TGTrust, Certificate as TGCertificate}; use fluence::fce; +use trust_graph::{Certificate as TGCertificate, Trust as TGTrust}; #[fce] pub struct Certificate { @@ -7,12 +7,9 @@ pub struct Certificate { } impl From for Certificate { - fn from(t: TGCertificate) -> Self { let chain: Vec = t.chain.into_iter().map(|t| t.into()).collect(); - return Certificate { - chain - } + return Certificate { chain }; } } @@ -30,7 +27,6 @@ pub struct Trust { } impl From for Trust { - fn from(t: TGTrust) -> Self { let issued_for = bs58::encode(t.issued_for.to_bytes()).into_string(); let signature = bs58::encode(t.signature.to_bytes()).into_string(); @@ -40,7 +36,7 @@ impl From for Trust { issued_for, expires_at, signature, - issued_at - } + issued_at, + }; } -} \ No newline at end of file +} diff --git a/bin/src/results.rs b/bin/src/results.rs index 98b0861..714d6d5 100644 --- a/bin/src/results.rs +++ b/bin/src/results.rs @@ -1,5 +1,5 @@ -use fluence::fce; use crate::proxy_structs::Certificate; +use fluence::fce; #[fce] pub struct InsertResult { @@ -26,7 +26,7 @@ impl From> for InsertResult { pub struct WeightResult { pub ret_code: u32, pub weight: Vec, - pub error: String + pub error: String, } impl From, String>> for WeightResult { @@ -50,7 +50,7 @@ impl From, String>> for WeightResult { pub struct AllCertsResult { pub ret_code: u32, pub certificates: Vec, - pub error: String + pub error: String, } impl From, String>> for AllCertsResult { @@ -68,4 +68,4 @@ impl From, String>> for AllCertsResult { }, } } -} \ No newline at end of file +} diff --git a/bin/src/service_api.rs b/bin/src/service_api.rs index 730700b..b0868a3 100644 --- a/bin/src/service_api.rs +++ b/bin/src/service_api.rs @@ -1,3 +1,5 @@ +use crate::proxy_structs::Certificate; +use crate::results::{AllCertsResult, InsertResult, WeightResult}; use crate::storage_impl::get_data; use fluence::fce; use fluence_identity::{KeyPair, PublicKey}; @@ -5,9 +7,7 @@ use std::convert::{From, Into}; use std::fmt::Display; use std::str::FromStr; use std::time::Duration; -use trust_graph::{Certificate as TGCertificate}; -use crate::proxy_structs::Certificate; -use crate::results::{WeightResult, InsertResult, AllCertsResult}; +use trust_graph::Certificate as TGCertificate; fn insert_cert_impl(certificate: String, duration: u64) -> Result<(), String> { let duration = Duration::from_millis(duration); @@ -41,7 +41,8 @@ fn get_weight(public_key: String) -> WeightResult { fn string_to_public_key(public_key: String) -> Result { let public_key = bs58::decode(public_key) - .into_vec().map_err(|e| format!("Couldn't decode public_key from base58: {}", e))?; + .into_vec() + .map_err(|e| format!("Couldn't decode public_key from base58: {}", e))?; let public_key = PublicKey::from_bytes(&public_key) .map_err(|e| format!("Couldn't decode public_key: {}", e))?;