summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-09-29 10:17:57 +0300
committerLars Wirzenius <liw@sequoia-pgp.org>2021-09-30 08:31:18 +0300
commite060f7f5f186581848cdda5f50d7ddb7ea7d5948 (patch)
tree4c0de166371e02a9b9d7fc5c23c3b99823e1dcd5
parentc52c0b44f28c7a235002c77e8c27c32e8251e1e3 (diff)
Tell clippy loops that never loop are OK
We have two loops where the last statement is a return or a break, without there being a continue. This means the loops will never loop. This is a symptom of the code being hard to understand. We should probably rewrite the logic without a loop, but I did not feel confident doing that yet. Found by clippy lint never_loop: https://rust-lang.github.io/rust-clippy/master/index.html#never_loop
-rw-r--r--sq/src/commands/mod.rs1
-rw-r--r--sq/src/sq.rs1
2 files changed, 2 insertions, 0 deletions
diff --git a/sq/src/commands/mod.rs b/sq/src/commands/mod.rs
index 61c05133..304ee475 100644
--- a/sq/src/commands/mod.rs
+++ b/sq/src/commands/mod.rs
@@ -52,6 +52,7 @@ pub mod net;
pub mod certify;
/// Returns suitable signing keys from a given list of Certs.
+#[allow(clippy::never_loop)]
fn get_signing_keys(certs: &[openpgp::Cert], p: &dyn Policy,
timestamp: Option<SystemTime>)
-> Result<Vec<crypto::KeyPair>>
diff --git a/sq/src/sq.rs b/sq/src/sq.rs
index e2ed3130..d9a22b74 100644
--- a/sq/src/sq.rs
+++ b/sq/src/sq.rs
@@ -218,6 +218,7 @@ const ARMOR_DETECTION_LIMIT: u64 = 1 << 24;
///
/// Returns the given reader unchanged. If the detection fails,
/// armor::Kind::File is returned as safe default.
+#[allow(clippy::never_loop)]
fn detect_armor_kind(input: Box<dyn BufferedReader<()>>)
-> (Box<dyn BufferedReader<()>>, armor::Kind) {
let mut dup = Limitor::new(Dup::new(input), ARMOR_DETECTION_LIMIT).as_boxed();