X-Git-Url: https://code.octet-stream.net/hashgood/blobdiff_plain/812e65c4bd80677d0f0a8e6dc72fda4b9e64709e..0252a4d67a68e71c811a6f7ec8057b616e65bca7:/src/verify.rs 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()); } }