mirror of
https://gitlab.com/keys.openpgp.org/hagrid.git
synced 2025-10-06 00:23:08 +02:00
Format code.
This commit is contained in:
@@ -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)?;
|
||||
|
@@ -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)?)
|
||||
}
|
||||
|
||||
|
@@ -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();
|
||||
|
14
src/mail.rs
14
src/mail.rs
@@ -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()
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user