From 98bd83e7ec07ae26da1f27a69785f6867034bfb3 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Thu, 28 Nov 2024 14:56:40 +0100 Subject: [PATCH] use cfg! --- src/main.rs | 7 +++++-- src/utils/misc.rs | 9 --------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/main.rs b/src/main.rs index 900426e..0794a45 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,7 +4,6 @@ use actix_web::{ web, App, HttpServer, }; use std::io::Result; -use utils::misc::is_debug; use crate::routes::{ agreements, api_v1, blog, contact, contrib, cours, cv, gaming, index, memorial, not_found, @@ -22,7 +21,11 @@ async fn main() -> Result<()> { let config = config::get_configuration("./config/config.toml"); let addr = ( - if is_debug() { "127.0.0.1" } else { "0.0.0.0" }, + if cfg!(debug_assertions) { + "127.0.0.1" + } else { + "0.0.0.0" + }, config.fc.port.unwrap(), ); diff --git a/src/utils/misc.rs b/src/utils/misc.rs index c9885fd..bbebd0b 100644 --- a/src/utils/misc.rs +++ b/src/utils/misc.rs @@ -87,12 +87,3 @@ fn read_pdf(data: Vec) -> File { ), } } -#[cfg(debug_assertions)] -pub fn is_debug() -> bool { - true -} - -#[cfg(not(debug_assertions))] -pub fn is_debug() -> bool { - false -}