diff --git a/src/api.rs b/src/api.rs index 53418d0..49d7f84 100644 --- a/src/api.rs +++ b/src/api.rs @@ -140,11 +140,9 @@ fn pem_certs_from_bundle(pem: &[u8]) -> PbResult> { } else if line.contains("END CERTIFICATE") { current.push_str(line); current.push('\n'); - certs.push( - Certificate::from_pem(current.as_bytes()).map_err(|e| { - PbError::InvalidCertificate(format!("invalid certificate in bundle: {}", e)) - })?, - ); + certs.push(Certificate::from_pem(current.as_bytes()).map_err(|e| { + PbError::InvalidCertificate(format!("invalid certificate in bundle: {}", e)) + })?); in_cert = false; } else if in_cert { current.push_str(line); diff --git a/src/main.rs b/src/main.rs index 640fc6c..3ca6e72 100644 --- a/src/main.rs +++ b/src/main.rs @@ -68,10 +68,8 @@ fn handle_get(opts: &Opts) -> PbResult<()> { } } - if content.attachment.is_some() && opts.download.is_some() { - let attachment = content.attachment.as_ref().unwrap(); - let outfile = opts.download.as_ref().unwrap(); - + if let (Some(attachment), Some(outfile)) = (content.attachment.as_ref(), opts.download.as_ref()) + { let url = DataUrl::process(attachment)?; let (body, _) = url.decode_to_vec().unwrap();