diff options
-rw-r--r-- | src/main.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/main.rs b/src/main.rs index 9450068..9e18a85 100644 --- a/src/main.rs +++ b/src/main.rs @@ -111,12 +111,11 @@ fn check(pw: Password) -> Result<(), Box<::std::error::Error>> { } fn main() { - let mut passwords = Vec::new(); - for arg in env::args().skip(1) { - passwords.push(Password::new(&arg)); - }; + let (_args, passwords) : (Vec<String>, Vec<String>) = env::args() + .skip(1) + .partition(|arg| arg.starts_with('-')); for pw in passwords { - check(pw).unwrap(); + check(Password::new(&pw)).unwrap(); } } |