chore: fix all clippy warnings across workspace
This commit is contained in:
@@ -1376,12 +1376,12 @@ pub fn cmd_export(
|
||||
///
|
||||
/// Prints a summary. Does not require the encryption password (structural check only).
|
||||
pub fn cmd_export_verify(input: &Path) -> anyhow::Result<()> {
|
||||
use quicproquo_core::{verify_transcript_chain, ChainVerdict};
|
||||
use quicproquo_core::{validate_transcript_structure, ChainVerdict};
|
||||
|
||||
let data = std::fs::read(input)
|
||||
.with_context(|| format!("read transcript file '{}'", input.display()))?;
|
||||
|
||||
match verify_transcript_chain(&data)? {
|
||||
match validate_transcript_structure(&data)? {
|
||||
ChainVerdict::Ok { records } => {
|
||||
println!(
|
||||
"OK: transcript '{}' is structurally valid. {} record(s) found, hash chain intact.",
|
||||
|
||||
@@ -169,6 +169,7 @@ impl ConversationStore {
|
||||
|
||||
let salt = get_or_create_salt(&salt_path)?;
|
||||
let key = derive_convdb_key(password, &salt)?;
|
||||
#[allow(clippy::needless_borrows_for_generic_args)]
|
||||
let hex_key = Zeroizing::new(hex::encode(&*key));
|
||||
|
||||
let conn = Connection::open(db_path).context("open conversation db")?;
|
||||
@@ -188,6 +189,7 @@ impl ConversationStore {
|
||||
) -> anyhow::Result<()> {
|
||||
let salt = get_or_create_salt(salt_path)?;
|
||||
let key = derive_convdb_key(password, &salt)?;
|
||||
#[allow(clippy::needless_borrows_for_generic_args)]
|
||||
let hex_key = Zeroizing::new(hex::encode(&*key));
|
||||
|
||||
let enc_path = db_path.with_extension("convdb-enc");
|
||||
|
||||
@@ -914,11 +914,11 @@ fn parse_duration_secs(s: &str) -> Option<u32> {
|
||||
|
||||
/// Format a TTL in seconds into a human-friendly string.
|
||||
fn format_ttl(secs: u32) -> String {
|
||||
if secs >= 86400 && secs % 86400 == 0 {
|
||||
if secs >= 86400 && secs.is_multiple_of(86400) {
|
||||
format!("{} day(s)", secs / 86400)
|
||||
} else if secs >= 3600 && secs % 3600 == 0 {
|
||||
} else if secs >= 3600 && secs.is_multiple_of(3600) {
|
||||
format!("{} hour(s)", secs / 3600)
|
||||
} else if secs >= 60 && secs % 60 == 0 {
|
||||
} else if secs >= 60 && secs.is_multiple_of(60) {
|
||||
format!("{} minute(s)", secs / 60)
|
||||
} else {
|
||||
format!("{} second(s)", secs)
|
||||
|
||||
@@ -85,6 +85,7 @@ pub fn anyhow_is_retriable(err: &anyhow::Error) -> bool {
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[allow(clippy::unwrap_used)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ pub fn set_auth(auth: &mut auth::Builder<'_>) -> anyhow::Result<()> {
|
||||
)
|
||||
})?;
|
||||
auth.set_version(ctx.version);
|
||||
auth.set_access_token(&*ctx.access_token);
|
||||
auth.set_access_token(&ctx.access_token);
|
||||
auth.set_device_id(&ctx.device_id);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -217,6 +217,7 @@ pub fn sha256(bytes: &[u8]) -> Vec<u8> {
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[allow(clippy::unwrap_used)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
|
||||
@@ -93,6 +93,7 @@ pub fn clear_cached_session(state_path: &Path) {
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[allow(clippy::unwrap_used)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user