From 0252a4d67a68e71c811a6f7ec8057b616e65bca7 Mon Sep 17 00:00:00 2001 From: Thomas Karpiniec Date: Thu, 25 Mar 2021 22:34:08 +1100 Subject: [PATCH 1/1] Apply more recent rustfmt rules --- src/main.rs | 6 ++++-- src/verify.rs | 10 ++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index a82c40a..f0bf09c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -39,10 +39,12 @@ pub struct Opt { impl Opt { fn get_paste(&self) -> bool { - #[cfg(feature = "paste")] { + #[cfg(feature = "paste")] + { return self.paste; } - #[cfg(not(feature = "paste"))] { + #[cfg(not(feature = "paste"))] + { return false; } } diff --git a/src/verify.rs b/src/verify.rs index f5ba2a2..e519f8a 100644 --- a/src/verify.rs +++ b/src/verify.rs @@ -43,17 +43,18 @@ fn get_by_parameter(param: &str) -> Result { /// Generate a candidate hash from the system clipboard, or throw an error. fn get_from_clipboard() -> Result { - #[cfg(feature = "paste")] { + #[cfg(feature = "paste")] + { let mut ctx: ClipboardContext = match ClipboardProvider::new() { Ok(ctx) => ctx, Err(e) => return Err(format!("Error getting system clipboard: {}", e)), }; - + let possible_hash = match ctx.get_contents() { Ok(value) => value, Err(e) => format!("Error reading from clipboard: {}", e), }; - + let bytes = hex::decode(&possible_hash) .map_err(|_| "Clipboard contains invalid or truncated hex".to_owned())?; let alg = Algorithm::from_len(bytes.len())?; @@ -67,7 +68,8 @@ fn get_from_clipboard() -> Result { source: VerificationSource::Clipboard, }); } - #[cfg(not(feature = "paste"))] { + #[cfg(not(feature = "paste"))] + { return Err("Paste not implemented".to_owned()); } } -- 2.39.5