Remove unnecessary lookup.

- `Sq::resolve_cert` already returns the certificate.  Don't look it
    up again.
This commit is contained in:
Neal H. Walfield 2024-11-18 17:42:16 +01:00
parent 6ffdd4aab7
commit b49386a886
No known key found for this signature in database
GPG Key ID: 6863C9AD5B4D22D3
3 changed files with 3 additions and 10 deletions

View File

@ -22,10 +22,7 @@ use crate::common::password;
pub fn bind(sq: Sq, command: cli::key::subkey::bind::Command) -> Result<()>
{
let handle =
sq.resolve_cert(&command.cert, sequoia_wot::FULLY_TRUSTED)?.1;
let cert = sq.lookup_one(handle, None, true)?;
let cert = sq.resolve_cert(&command.cert, sequoia_wot::FULLY_TRUSTED)?.0;
let null_policy_;
let adoptee_policy: &dyn Policy = if command.allow_broken_crypto {

View File

@ -59,7 +59,7 @@ where CP: cert_designator::ArgumentPrefix,
let (cert, cert_source)
= sq.resolve_cert(&cert, sequoia_wot::FULLY_TRUSTED)?;
let cert = match cert_source {
match cert_source {
FileStdinOrKeyHandle::FileOrStdin(ref file) => {
// If it is not a TSK, there is nothing to do.
if ! cert.is_tsk() {
@ -68,12 +68,9 @@ where CP: cert_designator::ArgumentPrefix,
key material.",
cert.fingerprint(), file));
}
cert
}
FileStdinOrKeyHandle::KeyHandle(ref kh) => {
FileStdinOrKeyHandle::KeyHandle(ref _kh) => {
ks = Some(sq.key_store_or_else()?);
sq.lookup_one(kh, None, true)?
}
};

View File

@ -68,7 +68,6 @@ where P: cert_designator::ArgumentPrefix,
output = Some(FileOrStdout::new(None));
}
}
let cert = sq.lookup_one(cert_handle.clone(), None, true)?;
let mut primary_signer
= sq.get_primary_key(&cert, Some(&[GetKeysOptions::AllowNotAlive]))?;