From fcbc8709c44b9e295fc702035861de90ea593ef6 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Wed, 14 Mar 2018 12:41:49 +0100 Subject: Split main loop, first parse args then check passwords. --- src/main.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index ffe811e..9450068 100644 --- a/src/main.rs +++ b/src/main.rs @@ -111,10 +111,12 @@ fn check(pw: Password) -> Result<(), Box<::std::error::Error>> { } fn main() { + let mut passwords = Vec::new(); for arg in env::args().skip(1) { - let pw = Password::new(&arg); - println!("{}:{}:{}:", &arg, pw.range, pw.rest); + passwords.push(Password::new(&arg)); + }; + for pw in passwords { check(pw).unwrap(); - }; + } } -- cgit v1.2.3