chore: rustfmt the workspace and make clippy -D warnings pass
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
mod jobs;
|
||||
mod restore;
|
||||
mod audit;
|
||||
pub mod sessions;
|
||||
pub(crate) mod oidc_login;
|
||||
pub(crate) mod credentials;
|
||||
pub(crate) mod access;
|
||||
pub(crate) mod relations;
|
||||
mod audit;
|
||||
pub(crate) mod credentials;
|
||||
mod jobs;
|
||||
pub(crate) mod oidc_login;
|
||||
pub(crate) mod refresh;
|
||||
pub(crate) mod relations;
|
||||
mod restore;
|
||||
pub mod sessions;
|
||||
pub(crate) use restore::restore_target_mismatch;
|
||||
|
||||
use anyhow::Result;
|
||||
@@ -93,7 +93,12 @@ impl Db {
|
||||
"INTEGER NOT NULL DEFAULT 0",
|
||||
)?;
|
||||
ensure_column(&conn, "orbits", "retention", "TEXT")?;
|
||||
ensure_column(&conn, "orbits", "outpost_id", "TEXT REFERENCES outposts(id)")?;
|
||||
ensure_column(
|
||||
&conn,
|
||||
"orbits",
|
||||
"outpost_id",
|
||||
"TEXT REFERENCES outposts(id)",
|
||||
)?;
|
||||
credentials::migrate(&conn)?;
|
||||
jobs::migrate(&conn)?;
|
||||
restore::migrate(&conn)?;
|
||||
@@ -229,7 +234,10 @@ impl Db {
|
||||
WHERE id = ?2 AND outpost_id = ?3 AND provider = 'wormhole' AND dry_run = 0",
|
||||
params![id, orbit_id, outpost_id.to_string(), total],
|
||||
)?;
|
||||
anyhow::ensure!(inserted == 1, "Outpost assignment changed during upload initialization");
|
||||
anyhow::ensure!(
|
||||
inserted == 1,
|
||||
"Outpost assignment changed during upload initialization"
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -247,18 +255,29 @@ impl Db {
|
||||
Ok(self.conn.lock().unwrap().query_row(
|
||||
"SELECT EXISTS(SELECT 1 FROM orbits WHERE id=?1 AND outpost_id=?2
|
||||
AND provider='wormhole' AND dry_run=0)",
|
||||
params![orbit.to_string(), outpost.to_string()], |row| row.get(0),
|
||||
params![orbit.to_string(), outpost.to_string()],
|
||||
|row| row.get(0),
|
||||
)?)
|
||||
}
|
||||
|
||||
pub fn list_outposts(&self) -> Result<Vec<OutpostSummary>> {
|
||||
let conn = self.conn.lock().unwrap();
|
||||
let mut stmt = conn.prepare("SELECT id, name, last_seen, pairing_state FROM outposts ORDER BY name, id")?;
|
||||
let mut stmt = conn
|
||||
.prepare("SELECT id, name, last_seen, pairing_state FROM outposts ORDER BY name, id")?;
|
||||
let rows = stmt.query_map([], |row| {
|
||||
let id = Uuid::parse_str(&row.get::<_, String>(0)?).map_err(|err| {
|
||||
rusqlite::Error::FromSqlConversionFailure(0, rusqlite::types::Type::Text, Box::new(err))
|
||||
rusqlite::Error::FromSqlConversionFailure(
|
||||
0,
|
||||
rusqlite::types::Type::Text,
|
||||
Box::new(err),
|
||||
)
|
||||
})?;
|
||||
Ok(OutpostSummary { id, name: row.get(1)?, last_seen: row.get(2)?, pairing_state: row.get(3)? })
|
||||
Ok(OutpostSummary {
|
||||
id,
|
||||
name: row.get(1)?,
|
||||
last_seen: row.get(2)?,
|
||||
pairing_state: row.get(3)?,
|
||||
})
|
||||
})?;
|
||||
Ok(rows.collect::<rusqlite::Result<_>>()?)
|
||||
}
|
||||
@@ -372,7 +391,10 @@ fn ensure_column(conn: &Connection, table: &str, column: &str, decl: &str) -> Re
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
conn.execute(&format!("ALTER TABLE {table} ADD COLUMN {column} {decl}"), [])?;
|
||||
conn.execute(
|
||||
&format!("ALTER TABLE {table} ADD COLUMN {column} {decl}"),
|
||||
[],
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user