From: Thomas Karpiniec Date: Thu, 25 Mar 2021 11:34:08 +0000 (+1100) Subject: Apply more recent rustfmt rules X-Git-Tag: v0.2.0~5 X-Git-Url: https://code.octet-stream.net/hashgood/commitdiff_plain/0252a4d67a68e71c811a6f7ec8057b616e65bca7?hp=812e65c4bd80677d0f0a8e6dc72fda4b9e64709e Apply more recent rustfmt rules --- 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()); } }