From 13b97296f50fc409537a301e9c3a64ab203a35b8 Mon Sep 17 00:00:00 2001 From: Aiden McClelland <3732071+dr-bonez@users.noreply.github.com> Date: Wed, 27 Jul 2022 18:00:48 -0600 Subject: [PATCH] formatting (#1698) --- Makefile | 4 ++ backend/src/action.rs | 3 +- backend/src/backup/restore.rs | 55 +++++++++++++---------- backend/src/id.rs | 5 +-- backend/src/migration.rs | 3 +- backend/src/net/interface.rs | 4 +- backend/src/net/nginx.rs | 67 ++++++++++++++++------------- backend/src/procedure/js_scripts.rs | 21 ++++----- backend/src/s9pk/manifest.rs | 3 +- backend/src/status/health_check.rs | 3 +- backend/src/version/mod.rs | 6 ++- backend/src/version/v0_3_1.rs | 3 +- backend/src/version/v0_3_1_1.rs | 3 +- backend/src/volume.rs | 5 +-- libs/js_engine/src/lib.rs | 6 ++- libs/models/src/action_id.rs | 6 +-- libs/models/src/health_check_id.rs | 4 +- libs/models/src/id.rs | 5 ++- libs/models/src/id_unchecked.rs | 3 +- libs/models/src/interface_id.rs | 5 +-- libs/models/src/invalid_id.rs | 1 - libs/models/src/lib.rs | 40 ++++++++--------- libs/models/src/package_id.rs | 7 +-- libs/models/src/procedure_name.rs | 5 +-- libs/models/src/version.rs | 6 +-- libs/models/src/volume_id.rs | 6 +-- libs/rustfmt.toml | 2 + 27 files changed, 149 insertions(+), 132 deletions(-) create mode 100644 libs/rustfmt.toml diff --git a/Makefile b/Makefile index ddc646968..2e0fe52e1 100644 --- a/Makefile +++ b/Makefile @@ -33,6 +33,10 @@ clean: rm -rf patch-db/client/dist sudo rm -rf cargo-deps +format: + cd backend && cargo +nightly fmt + cd libs && cargo +nightly fmt + sdk: cd backend/ && ./install-sdk.sh diff --git a/backend/src/action.rs b/backend/src/action.rs index aca0ffc03..1734c3ce8 100644 --- a/backend/src/action.rs +++ b/backend/src/action.rs @@ -3,6 +3,7 @@ use std::collections::{BTreeMap, BTreeSet}; use clap::ArgMatches; use color_eyre::eyre::eyre; use indexmap::IndexSet; +pub use models::ActionId; use rpc_toolkit::command; use serde::{Deserialize, Serialize}; use tracing::instrument; @@ -16,8 +17,6 @@ use crate::util::serde::{display_serializable, parse_stdin_deserializable, IoFor use crate::util::Version; use crate::volume::Volumes; use crate::{Error, ResultExt}; - -pub use models::ActionId; #[derive(Clone, Debug, Default, Deserialize, Serialize)] pub struct Actions(pub BTreeMap); diff --git a/backend/src/backup/restore.rs b/backend/src/backup/restore.rs index 889a1f9e3..93bc8c96d 100644 --- a/backend/src/backup/restore.rs +++ b/backend/src/backup/restore.rs @@ -55,11 +55,8 @@ pub async fn restore_packages_rpc( let fs = target_id .load(&mut ctx.secret_store.acquire().await?) .await?; - let backup_guard = BackupMountGuard::mount( - TmpMountGuard::mount(&fs, ReadOnly).await?, - &password, - ) - .await?; + let backup_guard = + BackupMountGuard::mount(TmpMountGuard::mount(&fs, ReadOnly).await?, &password).await?; let (revision, backup_guard, tasks, _) = restore_packages(&ctx, &mut db, backup_guard, ids).await?; @@ -70,31 +67,45 @@ pub async fn restore_packages_rpc( match res.with_kind(crate::ErrorKind::Unknown) { Ok((Ok(_), _)) => (), Ok((Err(err), package_id)) => { - if let Err(err) = ctx.notification_manager.notify( - &mut db, - Some(package_id.clone()), - NotificationLevel::Error, - "Restoration Failure".to_string(), format!("Error restoring package {}: {}", package_id,err), (), None).await{ + if let Err(err) = ctx + .notification_manager + .notify( + &mut db, + Some(package_id.clone()), + NotificationLevel::Error, + "Restoration Failure".to_string(), + format!("Error restoring package {}: {}", package_id, err), + (), + None, + ) + .await + { tracing::error!("Failed to notify: {}", err); tracing::debug!("{:?}", err); - }; + }; tracing::error!("Error restoring package {}: {}", package_id, err); tracing::debug!("{:?}", err); - }, + } Err(e) => { - if let Err(err) = ctx.notification_manager.notify( - &mut db, - None, - NotificationLevel::Error, - "Restoration Failure".to_string(), format!("Error during restoration: {}", e), (), None).await { - + if let Err(err) = ctx + .notification_manager + .notify( + &mut db, + None, + NotificationLevel::Error, + "Restoration Failure".to_string(), + format!("Error during restoration: {}", e), + (), + None, + ) + .await + { tracing::error!("Failed to notify: {}", err); tracing::debug!("{:?}", err); } tracing::error!("Error restoring packages: {}", e); tracing::debug!("{:?}", e); - }, - + } } } if let Err(e) = backup_guard.unmount().await { @@ -256,7 +267,7 @@ pub async fn recover_full_embassy( if let Err(err) = rpc_ctx.notification_manager.notify( &mut db, Some(package_id.clone()), - NotificationLevel::Error, + NotificationLevel::Error, "Restoration Failure".to_string(), format!("Error restoring package {}: {}", package_id,err), (), None).await{ tracing::error!("Failed to notify: {}", err); tracing::debug!("{:?}", err); @@ -268,7 +279,7 @@ pub async fn recover_full_embassy( if let Err(err) = rpc_ctx.notification_manager.notify( &mut db, None, - NotificationLevel::Error, + NotificationLevel::Error, "Restoration Failure".to_string(), format!("Error during restoration: {}", e), (), None).await { tracing::error!("Failed to notify: {}", err); diff --git a/backend/src/id.rs b/backend/src/id.rs index 0e1b97ac2..a2dc95052 100644 --- a/backend/src/id.rs +++ b/backend/src/id.rs @@ -1,14 +1,11 @@ use std::fmt::Debug; use std::str::FromStr; +pub use models::{Id, IdUnchecked, InvalidId, SYSTEM_ID}; use serde::{Deserialize, Deserializer, Serialize}; use crate::util::Version; -pub use models::{Id, InvalidId, IdUnchecked, SYSTEM_ID}; - - - #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize)] pub struct ImageId = String>(Id); impl> std::fmt::Display for ImageId { diff --git a/backend/src/migration.rs b/backend/src/migration.rs index 6abd8cd18..f4744b033 100644 --- a/backend/src/migration.rs +++ b/backend/src/migration.rs @@ -10,8 +10,7 @@ use tracing::instrument; use crate::context::RpcContext; use crate::id::ImageId; -use crate::procedure::PackageProcedure; -use crate::procedure::ProcedureName; +use crate::procedure::{PackageProcedure, ProcedureName}; use crate::s9pk::manifest::PackageId; use crate::util::Version; use crate::volume::Volumes; diff --git a/backend/src/net/interface.rs b/backend/src/net/interface.rs index 522170c1a..371fc4cdf 100644 --- a/backend/src/net/interface.rs +++ b/backend/src/net/interface.rs @@ -4,6 +4,7 @@ use color_eyre::eyre::eyre; use futures::TryStreamExt; use indexmap::IndexSet; use itertools::Either; +pub use models::InterfaceId; use serde::{Deserialize, Deserializer, Serialize}; use sqlx::{Executor, Sqlite}; use torut::onion::TorSecretKeyV3; @@ -15,8 +16,6 @@ use crate::s9pk::manifest::PackageId; use crate::util::serde::Port; use crate::{Error, ResultExt}; -pub use models::InterfaceId; - #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(rename_all = "kebab-case")] pub struct Interfaces(pub BTreeMap); // TODO @@ -114,7 +113,6 @@ impl Interfaces { } } - #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(rename_all = "kebab-case")] pub struct Interface { diff --git a/backend/src/net/nginx.rs b/backend/src/net/nginx.rs index 91e0a602b..f85431a88 100644 --- a/backend/src/net/nginx.rs +++ b/backend/src/net/nginx.rs @@ -91,35 +91,44 @@ impl NginxControllerInner { for (id, meta) in interface_map.iter() { for (port, lan_port_config) in meta.lan_config.iter() { // get ssl certificate chain - let (listen_args, ssl_certificate_line, ssl_certificate_key_line, proxy_redirect_directive) = - if lan_port_config.ssl { - // these have already been written by the net controller - let package_path = nginx_root.join(format!("ssl/{}", package)); - if tokio::fs::metadata(&package_path).await.is_err() { - tokio::fs::create_dir_all(&package_path) - .await - .with_ctx(|_| { - (ErrorKind::Filesystem, package_path.display().to_string()) - })?; - } - let ssl_path_key = package_path.join(format!("{}.key.pem", id)); - let ssl_path_cert = package_path.join(format!("{}.cert.pem", id)); - let (key, chain) = ssl_manager - .certificate_for(&meta.dns_base, &package) - .await?; - tokio::try_join!( - crate::net::ssl::export_key(&key, &ssl_path_key), - crate::net::ssl::export_cert(&chain, &ssl_path_cert) - )?; - ( - format!("{} ssl", port.0), - format!("ssl_certificate {};", ssl_path_cert.to_str().unwrap()), - format!("ssl_certificate_key {};", ssl_path_key.to_str().unwrap()), - format!("proxy_redirect http://$host/ https://$host/;"), - ) - } else { - (format!("{}", port.0), String::from(""), String::from(""), String::from("")) - }; + let ( + listen_args, + ssl_certificate_line, + ssl_certificate_key_line, + proxy_redirect_directive, + ) = if lan_port_config.ssl { + // these have already been written by the net controller + let package_path = nginx_root.join(format!("ssl/{}", package)); + if tokio::fs::metadata(&package_path).await.is_err() { + tokio::fs::create_dir_all(&package_path) + .await + .with_ctx(|_| { + (ErrorKind::Filesystem, package_path.display().to_string()) + })?; + } + let ssl_path_key = package_path.join(format!("{}.key.pem", id)); + let ssl_path_cert = package_path.join(format!("{}.cert.pem", id)); + let (key, chain) = ssl_manager + .certificate_for(&meta.dns_base, &package) + .await?; + tokio::try_join!( + crate::net::ssl::export_key(&key, &ssl_path_key), + crate::net::ssl::export_cert(&chain, &ssl_path_cert) + )?; + ( + format!("{} ssl", port.0), + format!("ssl_certificate {};", ssl_path_cert.to_str().unwrap()), + format!("ssl_certificate_key {};", ssl_path_key.to_str().unwrap()), + format!("proxy_redirect http://$host/ https://$host/;"), + ) + } else { + ( + format!("{}", port.0), + String::from(""), + String::from(""), + String::from(""), + ) + }; // write nginx configs let nginx_conf_path = nginx_root.join(format!( "sites-available/{}_{}_{}.conf", diff --git a/backend/src/procedure/js_scripts.rs b/backend/src/procedure/js_scripts.rs index 98738aead..8bd9cb360 100644 --- a/backend/src/procedure/js_scripts.rs +++ b/backend/src/procedure/js_scripts.rs @@ -1,21 +1,18 @@ -use std::{ - path::{Path, PathBuf}, - time::Duration, -}; +use std::path::{Path, PathBuf}; +use std::time::Duration; +pub use js_engine::JsError; +use js_engine::{JsExecutionEnvironment, PathForVolumeId}; use models::VolumeId; use serde::{Deserialize, Serialize}; use tracing::instrument; -use crate::{ - context::RpcContext, s9pk::manifest::PackageId, util::Version, volume::Volumes, Error, -}; - -use js_engine::{JsExecutionEnvironment, PathForVolumeId}; - use super::ProcedureName; - -pub use js_engine::JsError; +use crate::context::RpcContext; +use crate::s9pk::manifest::PackageId; +use crate::util::Version; +use crate::volume::Volumes; +use crate::Error; #[derive(Debug, Serialize, Deserialize, Clone)] #[serde(rename_all = "kebab-case")] diff --git a/backend/src/s9pk/manifest.rs b/backend/src/s9pk/manifest.rs index f51219846..217bdca61 100644 --- a/backend/src/s9pk/manifest.rs +++ b/backend/src/s9pk/manifest.rs @@ -1,6 +1,7 @@ use std::path::{Path, PathBuf}; use color_eyre::eyre::eyre; +pub use models::{PackageId, SYSTEM_PACKAGE_ID}; use patch_db::HasModel; use serde::{Deserialize, Serialize}; use url::Url; @@ -18,8 +19,6 @@ use crate::version::{Current, VersionT}; use crate::volume::Volumes; use crate::Error; -pub use models::{PackageId, SYSTEM_PACKAGE_ID}; - fn current_version() -> Version { Current::new().semver().into() } diff --git a/backend/src/status/health_check.rs b/backend/src/status/health_check.rs index 2705ff4ba..246e7a18a 100644 --- a/backend/src/status/health_check.rs +++ b/backend/src/status/health_check.rs @@ -1,6 +1,7 @@ use std::collections::{BTreeMap, BTreeSet}; use chrono::{DateTime, Utc}; +pub use models::HealthCheckId; use serde::{Deserialize, Serialize}; use tracing::instrument; @@ -13,8 +14,6 @@ use crate::util::Version; use crate::volume::Volumes; use crate::{Error, ResultExt}; -pub use models::HealthCheckId; - #[derive(Clone, Debug, Deserialize, Serialize)] pub struct HealthChecks(pub BTreeMap); impl HealthChecks { diff --git a/backend/src/version/mod.rs b/backend/src/version/mod.rs index 3020d9c9b..d40be7fe9 100644 --- a/backend/src/version/mod.rs +++ b/backend/src/version/mod.rs @@ -5,7 +5,8 @@ use color_eyre::eyre::eyre; use patch_db::DbHandle; use rpc_toolkit::command; -use crate::{init::InitReceipts, Error}; +use crate::init::InitReceipts; +use crate::Error; mod v0_3_0; mod v0_3_0_1; @@ -198,9 +199,10 @@ pub fn git_info() -> Result<&'static str, Error> { #[cfg(test)] mod tests { - use super::*; use proptest::prelude::*; + use super::*; + fn em_version() -> impl Strategy { any::<(usize, usize, usize, usize)>().prop_map(|(major, minor, patch, super_minor)| { emver::Version::new(major, minor, patch, super_minor) diff --git a/backend/src/version/v0_3_1.rs b/backend/src/version/v0_3_1.rs index fdb0418cf..315ee5e0d 100644 --- a/backend/src/version/v0_3_1.rs +++ b/backend/src/version/v0_3_1.rs @@ -1,6 +1,7 @@ use emver::VersionRange; -use super::{v0_3_0::V0_3_0_COMPAT, *}; +use super::v0_3_0::V0_3_0_COMPAT; +use super::*; const V0_3_1: emver::Version = emver::Version::new(0, 3, 1, 0); diff --git a/backend/src/version/v0_3_1_1.rs b/backend/src/version/v0_3_1_1.rs index 055a3bd45..48d8b8bee 100644 --- a/backend/src/version/v0_3_1_1.rs +++ b/backend/src/version/v0_3_1_1.rs @@ -1,6 +1,7 @@ use emver::VersionRange; -use super::{v0_3_0::V0_3_0_COMPAT, *}; +use super::v0_3_0::V0_3_0_COMPAT; +use super::*; const V0_3_1_1: emver::Version = emver::Version::new(0, 3, 1, 1); diff --git a/backend/src/volume.rs b/backend/src/volume.rs index 890106185..8339e1564 100644 --- a/backend/src/volume.rs +++ b/backend/src/volume.rs @@ -2,6 +2,8 @@ use std::collections::BTreeMap; use std::ops::{Deref, DerefMut}; use std::path::{Path, PathBuf}; +pub use helpers::script_dir; +pub use models::VolumeId; use patch_db::{HasModel, Map, MapModel}; use serde::{Deserialize, Serialize}; use tracing::instrument; @@ -13,9 +15,6 @@ use crate::s9pk::manifest::PackageId; use crate::util::Version; use crate::{Error, ResultExt}; -pub use helpers::script_dir; -pub use models::VolumeId; - pub const PKG_VOLUME_DIR: &str = "package-data/volumes"; pub const BACKUP_DIR: &str = "/media/embassy-os/backups"; diff --git a/libs/js_engine/src/lib.rs b/libs/js_engine/src/lib.rs index 36c9c50d5..3f9e765d8 100644 --- a/libs/js_engine/src/lib.rs +++ b/libs/js_engine/src/lib.rs @@ -338,11 +338,12 @@ impl JsExecutionEnvironment { /// Note: Make sure that we have the assumption that all these methods are callable at any time, and all call restrictions should be in rust mod fns { + use std::cell::RefCell; + use std::collections::BTreeMap; use std::convert::TryFrom; use std::os::unix::fs::MetadataExt; use std::path::{Path, PathBuf}; use std::rc::Rc; - use std::{cell::RefCell, collections::BTreeMap}; use deno_core::anyhow::{anyhow, bail}; use deno_core::error::AnyError; @@ -530,8 +531,9 @@ mod fns { } let new_volume_tmp = to_tmp_path(&volume_path).map_err(|e| anyhow!("{}", e))?; let hashed_name = { - use sha2::{Digest, Sha256}; use std::os::unix::ffi::OsStrExt; + + use sha2::{Digest, Sha256}; let mut hasher = Sha256::new(); hasher.update(path_in.as_os_str().as_bytes()); diff --git a/libs/models/src/action_id.rs b/libs/models/src/action_id.rs index 32460b7a3..8ce73ded3 100644 --- a/libs/models/src/action_id.rs +++ b/libs/models/src/action_id.rs @@ -1,10 +1,10 @@ -use std::{str::FromStr, path::Path}; +use std::path::Path; +use std::str::FromStr; -use serde::{Serialize, Deserialize}; +use serde::{Deserialize, Serialize}; use crate::{Id, InvalidId}; - #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize)] pub struct ActionId = String>(Id); impl FromStr for ActionId { diff --git a/libs/models/src/health_check_id.rs b/libs/models/src/health_check_id.rs index 71e26d2b5..a2c757d36 100644 --- a/libs/models/src/health_check_id.rs +++ b/libs/models/src/health_check_id.rs @@ -1,6 +1,6 @@ use std::path::Path; -use serde::{Serialize, Deserialize, Deserializer}; +use serde::{Deserialize, Deserializer, Serialize}; use crate::Id; @@ -32,4 +32,4 @@ impl> AsRef for HealthCheckId { fn as_ref(&self) -> &Path { self.0.as_ref().as_ref() } -} \ No newline at end of file +} diff --git a/libs/models/src/id.rs b/libs/models/src/id.rs index 29f16bfef..79e725b5c 100644 --- a/libs/models/src/id.rs +++ b/libs/models/src/id.rs @@ -2,7 +2,8 @@ use std::borrow::Borrow; use serde::{Deserialize, Deserializer, Serialize, Serializer}; -use crate::{invalid_id::InvalidId, id_unchecked::IdUnchecked}; +use crate::id_unchecked::IdUnchecked; +use crate::invalid_id::InvalidId; pub const SYSTEM_ID: Id<&'static str> = Id("x_system"); @@ -72,4 +73,4 @@ impl> Serialize for Id { { serializer.serialize_str(self.as_ref()) } -} \ No newline at end of file +} diff --git a/libs/models/src/id_unchecked.rs b/libs/models/src/id_unchecked.rs index f6f289898..a11208506 100644 --- a/libs/models/src/id_unchecked.rs +++ b/libs/models/src/id_unchecked.rs @@ -2,7 +2,6 @@ use std::borrow::Cow; use serde::{Deserialize, Deserializer}; - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] pub struct IdUnchecked>(pub S); impl<'de> Deserialize<'de> for IdUnchecked> { @@ -53,4 +52,4 @@ impl<'de> Deserialize<'de> for IdUnchecked<&'de str> { { Ok(IdUnchecked(<&'de str>::deserialize(deserializer)?)) } -} \ No newline at end of file +} diff --git a/libs/models/src/interface_id.rs b/libs/models/src/interface_id.rs index 44af99aaf..25dafaff4 100644 --- a/libs/models/src/interface_id.rs +++ b/libs/models/src/interface_id.rs @@ -1,10 +1,9 @@ use std::path::Path; -use serde::{Serialize, Deserialize, Deserializer}; +use serde::{Deserialize, Deserializer, Serialize}; use crate::Id; - #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize)] pub struct InterfaceId = String>(Id); impl> From> for InterfaceId { @@ -44,4 +43,4 @@ impl> AsRef for InterfaceId { fn as_ref(&self) -> &Path { self.0.as_ref().as_ref() } -} \ No newline at end of file +} diff --git a/libs/models/src/invalid_id.rs b/libs/models/src/invalid_id.rs index adccefab3..d2cc82bd5 100644 --- a/libs/models/src/invalid_id.rs +++ b/libs/models/src/invalid_id.rs @@ -1,4 +1,3 @@ - #[derive(Debug, thiserror::Error)] #[error("Invalid ID")] pub struct InvalidId; diff --git a/libs/models/src/lib.rs b/libs/models/src/lib.rs index 8a1e43843..7d088ec62 100644 --- a/libs/models/src/lib.rs +++ b/libs/models/src/lib.rs @@ -1,21 +1,21 @@ - mod id; - mod invalid_id; - mod id_unchecked; - mod version; - mod volume_id; - mod interface_id; - mod package_id; - mod procedure_name; - mod health_check_id; - mod action_id; +mod action_id; +mod health_check_id; +mod id; +mod id_unchecked; +mod interface_id; +mod invalid_id; +mod package_id; +mod procedure_name; +mod version; +mod volume_id; - pub use id::*; - pub use invalid_id::*; - pub use id_unchecked::*; - pub use version::*; - pub use volume_id::*; - pub use interface_id::*; - pub use package_id::*; - pub use procedure_name::*; - pub use health_check_id::*; - pub use action_id::*; \ No newline at end of file +pub use action_id::*; +pub use health_check_id::*; +pub use id::*; +pub use id_unchecked::*; +pub use interface_id::*; +pub use invalid_id::*; +pub use package_id::*; +pub use procedure_name::*; +pub use version::*; +pub use volume_id::*; diff --git a/libs/models/src/package_id.rs b/libs/models/src/package_id.rs index d97698dfc..3f4d94834 100644 --- a/libs/models/src/package_id.rs +++ b/libs/models/src/package_id.rs @@ -1,10 +1,11 @@ -use std::{str::FromStr, borrow::Borrow, path::Path}; +use std::borrow::Borrow; +use std::path::Path; +use std::str::FromStr; use serde::{Deserialize, Serialize, Serializer}; use crate::{Id, InvalidId, SYSTEM_ID}; - pub const SYSTEM_PACKAGE_ID: PackageId<&'static str> = PackageId(SYSTEM_ID); #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct PackageId = String>(Id); @@ -82,4 +83,4 @@ where { Serialize::serialize(&self.0, serializer) } -} \ No newline at end of file +} diff --git a/libs/models/src/procedure_name.rs b/libs/models/src/procedure_name.rs index df7c22866..10b490402 100644 --- a/libs/models/src/procedure_name.rs +++ b/libs/models/src/procedure_name.rs @@ -1,5 +1,4 @@ -use crate::{PackageId, HealthCheckId, ActionId}; - +use crate::{ActionId, HealthCheckId, PackageId}; #[derive(Debug, Clone)] pub enum ProcedureName { @@ -47,4 +46,4 @@ impl ProcedureName { ProcedureName::AutoConfig(id) => format!("/dependencies/{}/autoConfigure", id), } } -} \ No newline at end of file +} diff --git a/libs/models/src/version.rs b/libs/models/src/version.rs index d4b232b39..82b577820 100644 --- a/libs/models/src/version.rs +++ b/libs/models/src/version.rs @@ -1,10 +1,10 @@ -use std::{str::FromStr, ops::Deref}; use std::hash::{Hash, Hasher}; +use std::ops::Deref; +use std::str::FromStr; use patch_db::{HasModel, Model}; use serde::{Deserialize, Deserializer, Serialize, Serializer}; - #[derive(Debug, Clone)] pub struct Version { version: emver::Version, @@ -107,4 +107,4 @@ impl Serialize for Version { } impl HasModel for Version { type Model = Model; -} \ No newline at end of file +} diff --git a/libs/models/src/volume_id.rs b/libs/models/src/volume_id.rs index 07573d198..c5215123e 100644 --- a/libs/models/src/volume_id.rs +++ b/libs/models/src/volume_id.rs @@ -1,10 +1,10 @@ -use std::{borrow::Borrow, path::Path}; +use std::borrow::Borrow; +use std::path::Path; -use serde::{Deserialize, Serialize, Deserializer}; +use serde::{Deserialize, Deserializer, Serialize}; use crate::{Id, IdUnchecked}; - #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum VolumeId = String> { Backup, diff --git a/libs/rustfmt.toml b/libs/rustfmt.toml new file mode 100644 index 000000000..64d94def2 --- /dev/null +++ b/libs/rustfmt.toml @@ -0,0 +1,2 @@ +group_imports = "StdExternalCrate" +imports_granularity = "Module"