From 5986b77e1cbfb8437d691170cd9f401140326c84 Mon Sep 17 00:00:00 2001 From: Gil Cottle Date: Tue, 24 Jun 2014 23:26:24 -0400 Subject: [PATCH] Fix typo and code formatting --- hashsum/hashsum.rs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/hashsum/hashsum.rs b/hashsum/hashsum.rs index a8cce3b65..01da1869c 100644 --- a/hashsum/hashsum.rs +++ b/hashsum/hashsum.rs @@ -180,17 +180,25 @@ fn hashsum(algoname: &str, mut digest: Box, files: Vec, binary: ); if check { - // Set up Regexs for line validation and parsing + // Set up Regexes for line validation and parsing let bytes = digest.output_bits() / 4; - let gnu_re = safe_unwrap!(Regex::new(format!( + let gnu_re = safe_unwrap!( + Regex::new( + format!( r"^(?P[a-fA-F0-9]{{{}}}) (?P[ \*])(?P.*)", bytes - ).as_slice())); - let bsd_re = safe_unwrap!(Regex::new(format!( + ).as_slice() + ) + ); + let bsd_re = safe_unwrap!( + Regex::new( + format!( r"^{algorithm} \((?P.*)\) = (?P[a-fA-F0-9]{{{digest_size}}})", algorithm = algoname, digest_size = bytes - ).as_slice())); + ).as_slice() + ) + ); let mut buffer = file; for (i, line) in buffer.lines().enumerate() {