Back out "Fix linting errors after Rust version upgrade."

This backs out commit 0fe99ba962.
This commit is contained in:
Vincent Breitmoser
2025-09-28 23:49:13 +02:00
parent 2395244b8f
commit 2e9a14f58e
5 changed files with 49 additions and 50 deletions

View File

@@ -332,10 +332,10 @@ fn symlink(symlink_content: &Path, symlink_name: &Path) -> anyhow::Result<()> {
}
fn symlink_unlink_with_check(link: &Path, expected: &Path) -> anyhow::Result<()> {
if let Ok(target) = read_link(link)
&& target == expected
{
remove_file(link)?;
if let Ok(target) = read_link(link) {
if target == expected {
remove_file(link)?;
}
}
Ok(())
@@ -507,15 +507,15 @@ impl<'a> DatabaseTransaction<'a> for FilesystemTransaction<'a> {
)
.unwrap();
if let Ok(target) = read_link(&link_fpr)
&& target == expected
{
remove_file(&link_fpr)?;
if let Ok(target) = read_link(&link_fpr) {
if target == expected {
remove_file(&link_fpr)?;
}
}
if let Ok(target) = read_link(&link_keyid)
&& target == expected
{
remove_file(link_keyid)?;
if let Ok(target) = read_link(&link_keyid) {
if target == expected {
remove_file(link_keyid)?;
}
}
Ok(())
@@ -627,24 +627,24 @@ impl<'a> Database<'a> for Filesystem {
let path_published = self.fingerprint_to_path_published(fpr_target);
if let Ok(link_fpr_target) = link_fpr.canonicalize()
&& !link_fpr_target.ends_with(&path_published)
{
info!(
"Fingerprint points to different key for {} (expected {:?} to be suffix of {:?})",
fpr, &path_published, &link_fpr_target
);
return Err(anyhow!(format!("Fingerprint collision for key {}", fpr)));
if let Ok(link_fpr_target) = link_fpr.canonicalize() {
if !link_fpr_target.ends_with(&path_published) {
info!(
"Fingerprint points to different key for {} (expected {:?} to be suffix of {:?})",
fpr, &path_published, &link_fpr_target
);
return Err(anyhow!(format!("Fingerprint collision for key {}", fpr)));
}
}
if let Ok(link_keyid_target) = link_keyid.canonicalize()
&& !link_keyid_target.ends_with(&path_published)
{
info!(
"KeyID points to different key for {} (expected {:?} to be suffix of {:?})",
fpr, &path_published, &link_keyid_target
);
return Err(anyhow!(format!("KeyID collision for key {}", fpr)));
if let Ok(link_keyid_target) = link_keyid.canonicalize() {
if !link_keyid_target.ends_with(&path_published) {
info!(
"KeyID points to different key for {} (expected {:?} to be suffix of {:?})",
fpr, &path_published, &link_keyid_target
);
return Err(anyhow!(format!("KeyID collision for key {}", fpr)));
}
}
if !link_fpr.exists() || !link_keyid.exists() {

View File

@@ -531,16 +531,15 @@ pub trait Database<'a>: Sync + Send {
) -> anyhow::Result<()> {
let current_link_fpr =
self.lookup_primary_fingerprint(&Query::ByEmail(unlink_email.clone()));
if let Some(current_fpr) = current_link_fpr
&& current_fpr != *fpr_primary
{
self.set_email_unpublished_filter(tx, &current_fpr, |uid| {
Email::try_from(uid)
.map(|email| email != *unlink_email)
.unwrap_or(false)
})?;
if let Some(current_fpr) = current_link_fpr {
if current_fpr != *fpr_primary {
self.set_email_unpublished_filter(tx, &current_fpr, |uid| {
Email::try_from(uid)
.map(|email| email != *unlink_email)
.unwrap_or(false)
})?;
}
}
Ok(())
}

View File

@@ -76,10 +76,10 @@ pub(crate) fn run(
"Deleted".into()
}
);
if err.is_ok()
&& let Err(e) = result
{
err = Err(e);
if err.is_ok() {
if let Err(e) = result {
err = Err(e);
}
}
}

View File

@@ -194,11 +194,11 @@ fn read_file_to_tpks(
let (packet, tmp) = pp.next()?;
ppr = tmp;
if !acc.is_empty()
&& let Packet::PublicKey(_) | Packet::SecretKey(_) = packet
{
callback(acc);
acc = vec![];
if !acc.is_empty() {
if let Packet::PublicKey(_) | Packet::SecretKey(_) = packet {
callback(acc);
acc = vec![];
}
}
acc.push(packet);

View File

@@ -519,10 +519,10 @@ impl PacketDumper {
write!(output, "{} S2K: ", ii)?;
pd.dump_s2k(output, &ii, e.s2k())?;
writeln!(output, "{} Sym. algo: {}", ii, e.algo())?;
if pd.mpis
&& let Ok(ciphertext) = e.ciphertext()
{
pd.dump_mpis(output, &ii, &[ciphertext], &["ciphertext"])?;
if pd.mpis {
if let Ok(ciphertext) = e.ciphertext() {
pd.dump_mpis(output, &ii, &[ciphertext], &["ciphertext"])?;
}
}
}
}