diff options
author | Nora Widdecke <nora@sequoia-pgp.org> | 2021-04-07 20:35:38 +0200 |
---|---|---|
committer | Nora Widdecke <nora@sequoia-pgp.org> | 2021-04-09 13:13:59 +0200 |
commit | 73b3321d98e0298dba5d4ef63e8058a01cc2943c (patch) | |
tree | 0b5ef2427f8d95085c2819c8e9dba02c3c6f0c65 /sq | |
parent | 19169b76117db8b1d81f1aafa64a5440d042803d (diff) |
Lint: Use next instead of nth(0).
- https://rust-lang.github.io/rust-clippy/master/index.html#iter_nth_zero
Diffstat (limited to 'sq')
-rw-r--r-- | sq/build.rs | 2 | ||||
-rw-r--r-- | sq/src/commands/inspect.rs | 2 | ||||
-rw-r--r-- | sq/src/commands/key.rs | 2 | ||||
-rw-r--r-- | sq/src/commands/keyring.rs | 4 | ||||
-rw-r--r-- | sq/tests/sq-sign.rs | 2 |
5 files changed, 6 insertions, 6 deletions
diff --git a/sq/build.rs b/sq/build.rs index 5cc59cc0..49d55740 100644 --- a/sq/build.rs +++ b/sq/build.rs @@ -87,7 +87,7 @@ fn dump_help(sink: &mut dyn io::Write, if line.chars().nth(4).map(|c| ! c.is_ascii_whitespace()) .unwrap_or(false) { - line.trim_start().split(" ").nth(0) + line.trim_start().split(" ").next() } else { None } diff --git a/sq/src/commands/inspect.rs b/sq/src/commands/inspect.rs index e4be6883..fa990951 100644 --- a/sq/src/commands/inspect.rs +++ b/sq/src/commands/inspect.rs @@ -142,7 +142,7 @@ fn inspect_cert(policy: &dyn Policy, writeln!(output)?; writeln!(output, " Fingerprint: {}", cert.fingerprint())?; inspect_revocation(output, "", cert.revocation_status(policy, None))?; - inspect_key(policy, output, "", cert.keys().nth(0).unwrap(), + inspect_key(policy, output, "", cert.keys().next().unwrap(), print_certifications)?; writeln!(output)?; diff --git a/sq/src/commands/key.rs b/sq/src/commands/key.rs index daba78df..5dd45809 100644 --- a/sq/src/commands/key.rs +++ b/sq/src/commands/key.rs @@ -357,7 +357,7 @@ fn adopt(config: Config, m: &ArgMatches) -> Result<()> { &cert.primary_key(), &key).is_ok() }) - .nth(0) + .next() .map(|sig| SignatureBuilder::from(sig.clone())) .unwrap_or_else(|| { SignatureBuilder::new(SignatureType::PrimaryKeyBinding) diff --git a/sq/src/commands/keyring.rs b/sq/src/commands/keyring.rs index 51c5dd13..81fce15e 100644 --- a/sq/src/commands/keyring.rs +++ b/sq/src/commands/keyring.rs @@ -254,7 +254,7 @@ fn list(config: Config, // As a last resort, pick the first user id. if primary_uid.is_none() { - if let Some(primary) = cert.userids().nth(0) { + if let Some(primary) = cert.userids().next() { println!(" {}", String::from_utf8_lossy(primary.value())); primary_uid = Some(primary.value().to_vec()); } @@ -296,7 +296,7 @@ fn split(input: &mut (dyn io::Read + Sync + Send), prefix: &str, binary: bool) // Try to be more helpful by including the first userid in the // filename. - let mut sink = if let Some(f) = cert.userids().nth(0) + let mut sink = if let Some(f) = cert.userids().next() .and_then(|uid| uid.email().unwrap_or(None)) .and_then(to_filename_fragment) { diff --git a/sq/tests/sq-sign.rs b/sq/tests/sq-sign.rs index d9253124..0efef3ab 100644 --- a/sq/tests/sq-sign.rs +++ b/sq/tests/sq-sign.rs @@ -278,7 +278,7 @@ fn sq_sign_append_on_compress_then_sign() { // message by foot. let tsk = Cert::from_file(&artifact("keys/dennis-simon-anton-private.pgp")) .unwrap(); - let key = tsk.keys().with_policy(p, None).for_signing().nth(0).unwrap().key(); + let key = tsk.keys().with_policy(p, None).for_signing().next().unwrap().key(); let sec = match key.optional_secret() { Some(SecretKeyMaterial::Unencrypted(ref u)) => u.clone(), _ => unreachable!(), |