clippy pedantic clean + wired into flake checks
This commit is contained in:
parent
f12837fe32
commit
fef2dee92a
12 changed files with 55 additions and 25 deletions
|
|
@ -10,7 +10,7 @@ use anyhow::{Context, Result, bail};
|
|||
use hive_sh4re::{Approval, ApprovalStatus};
|
||||
use rusqlite::{Connection, OptionalExtension, params};
|
||||
|
||||
const SCHEMA: &str = r#"
|
||||
const SCHEMA: &str = r"
|
||||
CREATE TABLE IF NOT EXISTS approvals (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
agent TEXT NOT NULL,
|
||||
|
|
@ -22,7 +22,7 @@ CREATE TABLE IF NOT EXISTS approvals (
|
|||
);
|
||||
CREATE INDEX IF NOT EXISTS idx_approvals_pending
|
||||
ON approvals (id) WHERE status = 'pending';
|
||||
"#;
|
||||
";
|
||||
|
||||
pub struct Approvals {
|
||||
conn: Mutex<Connection>,
|
||||
|
|
@ -65,6 +65,7 @@ impl Approvals {
|
|||
.map_err(Into::into)
|
||||
}
|
||||
|
||||
#[allow(dead_code)] // used by Phase 5b commit verification
|
||||
pub fn get(&self, id: i64) -> Result<Option<Approval>> {
|
||||
let conn = self.conn.lock().unwrap();
|
||||
conn.query_row(
|
||||
|
|
@ -162,6 +163,7 @@ fn row_to_approval(row: &rusqlite::Row<'_>) -> rusqlite::Result<Approval> {
|
|||
fn now_unix() -> i64 {
|
||||
SystemTime::now()
|
||||
.duration_since(UNIX_EPOCH)
|
||||
.map(|d| d.as_secs() as i64)
|
||||
.ok()
|
||||
.and_then(|d| i64::try_from(d.as_secs()).ok())
|
||||
.unwrap_or(0)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue