Simplify expressions.

This commit is contained in:
Justus Winter 2023-11-24 12:52:57 +01:00
parent 239002b06e
commit c5f01fbf65
No known key found for this signature in database
GPG Key ID: 686F55B4AB2B3386
2 changed files with 8 additions and 8 deletions

View File

@ -101,11 +101,11 @@ pub fn check_userids(config: &Config, cert: &Cert, self_signed: bool,
if known_userids.iter().any(|known_userid| known_userid == &userid) {
results.push(userid);
} else {
let err = anyhow::anyhow!(format!(
let err = anyhow::anyhow!(
"{:?} does not match any self-signed User IDs. If you want \
to use a User ID that is not endorsed by the key's owner, \
use \"--petname\"",
String::from_utf8_lossy(userid.value())));
String::from_utf8_lossy(userid.value()));
print_error_chain(&err);
if error.is_none() {
error = Some(err);
@ -136,11 +136,11 @@ pub fn check_userids(config: &Config, cert: &Cert, self_signed: bool,
.collect::<Vec<UserID>>();
if matches.is_empty() {
let err = anyhow::anyhow!(format!(
let err = anyhow::anyhow!(
"{:?} does not match any valid, self-signed email \
addresses. If you want to use an email address that \
is not endorsed by the key's owner, use \"--petname\"",
email));
email);
print_error_chain(&err);
if error.is_none() {
error = Some(err);

View File

@ -391,12 +391,12 @@ impl<'store> Config<'store> {
PathBuf::from(pep_cert_store)
}
Ok(false) => {
return Err(anyhow::anyhow!(format!(
"{:?} does not exist", pep_cert_store)));
return Err(anyhow::anyhow!(
"{:?} does not exist", pep_cert_store));
}
Err(err) => {
return Err(anyhow::anyhow!(format!(
"Accessing {:?}: {}", pep_cert_store, err)));
return Err(anyhow::anyhow!(
"Accessing {:?}: {}", pep_cert_store, err));
}
}
};