diff options
author | David Runge <dave@sleepmap.de> | 2022-12-16 14:46:36 +0100 |
---|---|---|
committer | David Runge <dave@sleepmap.de> | 2022-12-16 16:51:02 +0100 |
commit | 1ff56b0de6701bec72c611d8b244bb5b0cf15547 (patch) | |
tree | a80961f2911330cd33f47a48067e2272ae98e9e8 /sq | |
parent | e1edd66a1b227f9ee487418af689986749a0c5f9 (diff) |
sq: Use std::time::Duration globally in sq/src/commands/inspect
- Use `std::time::Duration` globally to not repeat ourselves.
- Refactor the use of `Duration` so that conditional assignments
become more readable.
Diffstat (limited to 'sq')
-rw-r--r-- | sq/src/commands/inspect.rs | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/sq/src/commands/inspect.rs b/sq/src/commands/inspect.rs index 966c9959..fe6007c3 100644 --- a/sq/src/commands/inspect.rs +++ b/sq/src/commands/inspect.rs @@ -1,6 +1,6 @@ use std::convert::TryFrom; use std::io::{self, Read}; -use std::time::SystemTime; +use std::time::{Duration, SystemTime}; use anyhow::Context; @@ -203,10 +203,10 @@ fn inspect_cert( writeln!(output, " UserID: {}", uidb.userid())?; inspect_revocation(output, "", uidb.revocation_status(policy, None))?; match uidb.binding_signature(policy, None) { - Ok(sig) => if let Err(e) = - sig.signature_alive(None, std::time::Duration::new(0, 0)) - { - print_error_chain(output, &e)?; + Ok(sig) => { + if let Err(e) = sig.signature_alive(None, Duration::new(0, 0)) { + print_error_chain(output, &e)?; + } } Err(e) => print_error_chain(output, &e)?, } @@ -221,10 +221,10 @@ fn inspect_cert( uab.user_attribute())?; inspect_revocation(output, "", uab.revocation_status(policy, None))?; match uab.binding_signature(policy, None) { - Ok(sig) => if let Err(e) = - sig.signature_alive(None, std::time::Duration::new(0, 0)) - { - print_error_chain(output, &e)?; + Ok(sig) => { + if let Err(e) = sig.signature_alive(None, Duration::new(0, 0)) { + print_error_chain(output, &e)?; + } } Err(e) => print_error_chain(output, &e)?, } @@ -237,10 +237,10 @@ fn inspect_cert( for ub in cert.unknowns() { writeln!(output, " Unknown component: {:?}", ub.unknown())?; match ub.binding_signature(policy, None) { - Ok(sig) => if let Err(e) = - sig.signature_alive(None, std::time::Duration::new(0, 0)) - { - print_error_chain(output, &e)?; + Ok(sig) => { + if let Err(e) = sig.signature_alive(None, Duration::new(0, 0)) { + print_error_chain(output, &e)?; + } } Err(e) => print_error_chain(output, &e)?, } |