]> code.octet-stream.net Git - hashgood/commitdiff
Apply more recent rustfmt rules
authorThomas Karpiniec <tom.karpiniec@outlook.com>
Thu, 25 Mar 2021 11:34:08 +0000 (22:34 +1100)
committerThomas Karpiniec <tom.karpiniec@outlook.com>
Thu, 25 Mar 2021 11:34:08 +0000 (22:34 +1100)
src/main.rs
src/verify.rs

index a82c40a69f1d12ff400bee560dd41b52ba3079c5..f0bf09c72dfc6597cac47e094597133dfdb83723 100644 (file)
@@ -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;
         }
     }
index f5ba2a26187f0c00b5d27c4e163671ff55f48d27..e519f8a342d05096210daafead31f37d5df6acf0 100644 (file)
@@ -43,17 +43,18 @@ fn get_by_parameter(param: &str) -> Result<CandidateHashes, String> {
 
 /// Generate a candidate hash from the system clipboard, or throw an error.
 fn get_from_clipboard() -> Result<CandidateHashes, String> {
-    #[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<CandidateHashes, String> {
             source: VerificationSource::Clipboard,
         });
     }
-    #[cfg(not(feature = "paste"))] {
+    #[cfg(not(feature = "paste"))]
+    {
         return Err("Paste not implemented".to_owned());
     }
 }