mirror of
https://gitlab.com/keys.openpgp.org/hagrid.git
synced 2025-10-06 00:23:08 +02:00
Back out "Fix linting errors after Rust version upgrade."
This backs out commit 0fe99ba962
.
This commit is contained in:
@@ -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() {
|
||||
|
@@ -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, ¤t_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, ¤t_fpr, |uid| {
|
||||
Email::try_from(uid)
|
||||
.map(|email| email != *unlink_email)
|
||||
.unwrap_or(false)
|
||||
})?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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"])?;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user