diff options
author | khai96_ <hvksmr1996@gmail.com> | 2019-04-26 10:15:46 +0000 |
---|---|---|
committer | khai96_ <hvksmr1996@gmail.com> | 2019-04-26 10:15:46 +0000 |
commit | 7accdf8f480a34353c4d190ef893e51242275553 (patch) | |
tree | ebb46cbcdde44f87e0d02791bb8e3b20baf8ec37 | |
parent | Comply to change requests (diff) | |
download | miniserve-7accdf8f480a34353c4d190ef893e51242275553.tar.gz miniserve-7accdf8f480a34353c4d190ef893e51242275553.zip |
Use 'if let'
Diffstat (limited to '')
-rw-r--r-- | src/args.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/args.rs b/src/args.rs index 97b391f..4077f35 100644 --- a/src/args.rs +++ b/src/args.rs @@ -97,9 +97,10 @@ fn parse_auth(src: &str) -> Result<auth::RequiredAuth, ContextualError> { }; let password = if let Some(hash_hex) = split.next() { - let hash_bin = match hex::decode(hash_hex) { - Ok(hash_bin) => hash_bin, - _ => return Err(ContextualError::new(ContextualErrorKind::InvalidPasswordHash)), + let hash_bin = if let Ok(hash_bin) = hex::decode(hash_hex) { + hash_bin + } else { + return Err(ContextualError::new(ContextualErrorKind::InvalidPasswordHash)) }; match second_part { |