Format code.

This commit is contained in:
Zeke Fast
2025-04-29 00:14:10 +02:00
parent c28e6af441
commit 9094b09b27
5 changed files with 34 additions and 11 deletions

View File

@@ -125,7 +125,11 @@ pub trait DatabaseTransaction<'a> {
fn write_to_temp(&self, content: &[u8]) -> anyhow::Result<Self::TempCert>;
fn move_tmp_to_full(&self, content: Self::TempCert, fpr: &Fingerprint) -> anyhow::Result<()>;
fn move_tmp_to_published(&self, content: Self::TempCert, fpr: &Fingerprint) -> anyhow::Result<()>;
fn move_tmp_to_published(
&self,
content: Self::TempCert,
fpr: &Fingerprint,
) -> anyhow::Result<()>;
fn move_tmp_to_published_wkd(
&self,
content: Option<Self::TempCert>,
@@ -447,7 +451,11 @@ pub trait Database<'a>: Sync + Send {
/// - abort if any problems come up!
/// 5. Move full and published temporary Cert to their location
/// 6. Update all symlinks
fn set_email_published(&'a self, fpr_primary: &Fingerprint, email_new: &Email) -> anyhow::Result<()> {
fn set_email_published(
&'a self,
fpr_primary: &Fingerprint,
email_new: &Email,
) -> anyhow::Result<()> {
let tx = self.transaction()?;
self.unlink_email_if_other(&tx, fpr_primary, email_new)?;

View File

@@ -36,7 +36,9 @@ impl Sqlite {
}
#[cfg(test)]
fn build_pool(manager: SqliteConnectionManager) -> anyhow::Result<r2d2::Pool<SqliteConnectionManager>> {
fn build_pool(
manager: SqliteConnectionManager,
) -> anyhow::Result<r2d2::Pool<SqliteConnectionManager>> {
#[derive(Copy, Clone, Debug)]
pub struct LogConnectionCustomizer;
impl<E> r2d2::CustomizeConnection<rusqlite::Connection, E> for LogConnectionCustomizer {
@@ -59,7 +61,9 @@ impl Sqlite {
}
#[cfg(not(test))]
fn build_pool(manager: SqliteConnectionManager) -> anyhow::Result<r2d2::Pool<SqliteConnectionManager>> {
fn build_pool(
manager: SqliteConnectionManager,
) -> anyhow::Result<r2d2::Pool<SqliteConnectionManager>> {
Ok(r2d2::Pool::builder().build(manager)?)
}

View File

@@ -125,7 +125,11 @@ fn import_from_files(
Ok(())
}
fn import_from_file(db: &KeyDatabase, input: &Path, multi_progress: &MultiProgress) -> anyhow::Result<()> {
fn import_from_file(
db: &KeyDatabase,
input: &Path,
multi_progress: &MultiProgress,
) -> anyhow::Result<()> {
let input_file = File::open(input)?;
let bytes_total = input_file.metadata()?.len();

View File

@@ -71,7 +71,12 @@ impl Service {
}
/// Sends mail by storing it in the given directory.
pub fn filemail(from: &str, base_uri: &str, template_dir: &Path, path: &Path) -> anyhow::Result<Self> {
pub fn filemail(
from: &str,
base_uri: &str,
template_dir: &Path,
path: &Path,
) -> anyhow::Result<Self> {
Self::new(
from,
base_uri,
@@ -80,7 +85,12 @@ impl Service {
)
}
fn new(from: &str, base_uri: &str, template_dir: &Path, transport: Transport) -> anyhow::Result<Self> {
fn new(
from: &str,
base_uri: &str,
template_dir: &Path,
transport: Transport,
) -> anyhow::Result<Self> {
let templates = template_helpers::load_handlebars(template_dir)?;
let domain = url::Url::parse(base_uri)?
.host_str()

View File

@@ -45,10 +45,7 @@ use crate::web::maintenance::MaintenanceMode;
pub struct HagridTemplate(&'static str, serde_json::Value, I18n, RequestOrigin);
impl<'r> Responder<'r, 'static> for HagridTemplate {
fn respond_to(
self,
req: &'r rocket::Request,
) -> Result<Response<'static>, Status> {
fn respond_to(self, req: &'r rocket::Request) -> Result<Response<'static>, Status> {
let HagridTemplate(tmpl, ctx, i18n, origin) = self;
let template_overrides: &TemplateOverrides = req