From 4766af15103fcc9448398fe4b34208eb52f5be77 Mon Sep 17 00:00:00 2001 From: SamTV12345 <40429738+samtv12345@users.noreply.github.com> Date: Wed, 8 Nov 2023 15:53:48 +0100 Subject: [PATCH] Removed unnecessary macros. --- build.rs | 7 ------- src/config/dbconfig.rs | 2 -- src/dbconfig/mod.rs | 15 --------------- src/main.rs | 1 - 4 files changed, 25 deletions(-) diff --git a/build.rs b/build.rs index 65aa15f8..0e5650cb 100644 --- a/build.rs +++ b/build.rs @@ -6,16 +6,9 @@ use std::process::Command; fn main() { - #[cfg(feature = "sqlite")] - println!("cargo:rustc-cfg=sqlite"); - #[cfg(feature = "mysql")] - println!("cargo:rustc-cfg=mysql"); - #[cfg(feature = "postgresql")] - println!("cargo:rustc-cfg=postgresql"); let maybe_vaultwarden_version = env::var("VW_VERSION").or_else(|_| env::var("BWRS_VERSION")).or_else(|_| version_from_git_info()); - #[cfg(feature = "postgresql")] version_from_git_info().expect("Error retrieving git information"); create_git_sqlite(); diff --git a/src/config/dbconfig.rs b/src/config/dbconfig.rs index 1f0b0f54..679c0a47 100644 --- a/src/config/dbconfig.rs +++ b/src/config/dbconfig.rs @@ -4,7 +4,6 @@ use std::process::exit; use std::time::Duration; use crate::constants::inner_constants::{DATABASE_URL, DATABASE_URL_DEFAULT_SQLITE}; use crate::dbconfig::DBType; -#[cfg(sqlite)] use crate::DBType as DbConnection; #[derive(Debug)] @@ -14,7 +13,6 @@ pub struct ConnectionOptions { pub busy_timeout: Option, } -#[cfg(sqlite)] impl r2d2::CustomizeConnection for ConnectionOptions { diff --git a/src/dbconfig/mod.rs b/src/dbconfig/mod.rs index 20401f68..d2e99c0b 100644 --- a/src/dbconfig/mod.rs +++ b/src/dbconfig/mod.rs @@ -1,19 +1,6 @@ #[path = "schemas/sqlite/schema.rs"] pub mod schema; -#[cfg(mysql)] -#[path = "schemas/mysql/schema.rs"] -pub mod schema; - - -#[macro_export] -#[cfg(mysql)] -macro_rules! import_database_connections { - () => { - use diesel::MysqlConnection; - }; -} - #[derive(diesel::MultiConnection)] pub enum DBType { Postgresql(diesel::PgConnection), @@ -23,11 +10,9 @@ pub enum DBType { #[macro_export] macro_rules! import_database_config{ ()=>{ - #[cfg(sqlite)] pub const SQLITE_MIGRATIONS: EmbeddedMigrations = embed_migrations!("./migrations/sqlite"); - #[cfg(postgresql)] pub const POSTGRES_MIGRATIONS: EmbeddedMigrations = embed_migrations!("./migrations/postgres"); } } diff --git a/src/main.rs b/src/main.rs index 2bc2a31e..7227310b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -31,7 +31,6 @@ use regex::Regex; use tokio::task::spawn_blocking; mod controllers; -#[cfg(sqlite)] use crate::config::dbconfig::{ConnectionOptions}; use crate::config::dbconfig::{establish_connection, get_database_url}; use crate::constants::inner_constants::{BASIC_AUTH, CSS, JS, OIDC_AUTH, OIDC_CLIENT_ID, OIDC_JWKS, TELEGRAM_API_ENABLED, TELEGRAM_BOT_CHAT_ID, TELEGRAM_BOT_TOKEN};