Tried to add dependencies only for "dev" profile, but not successful. Conditional compiling has been added

This commit is contained in:
doryan 2024-06-09 03:26:48 +04:00
parent 6bde201ca2
commit b5a9315a2d
2 changed files with 23 additions and 6 deletions

View File

@ -1,5 +1,6 @@
[profile.release] [profile.release]
opt-level = 3 opt-level = 3
overflow-checks = false
[package] [package]
name = "dorya" name = "dorya"
@ -9,11 +10,13 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
actix-web = "4.6.0"
anyhow = "1.0.86" anyhow = "1.0.86"
async-trait = "0.1.80" async-trait = "0.1.80"
chrono = "0.4.38" chrono = "0.4.38"
dotenvy = "0.15.7" dotenvy = "0.15.7"
telers = { git = "https://github.com/doryan04/telers.git" } telers = { git = "https://github.com/doryan04/telers.git" }
tokio = { version="1.37.0", features=["rt-multi-thread"] } tokio = { version="1.37.0", features=["rt-multi-thread"] }
tracing = "0.1.40" tracing = {version = "0.1.40"}
tracing-subscriber = {version="0.3.18", features=["env-filter"]} tracing-subscriber = {version="0.3.18", features=["env-filter"]}

View File

@ -7,8 +7,6 @@ use telers::{
Bot, Dispatcher, Router, Bot, Dispatcher, Router,
}; };
use tracing_subscriber::{fmt, layer::SubscriberExt as _, util::SubscriberInitExt as _, EnvFilter};
mod assets; mod assets;
mod middlewares; mod middlewares;
mod types; mod types;
@ -22,12 +20,29 @@ use handlers::{
dice_handler::dice::dice_handler, dice_handler::dice::dice_handler,
}; };
#[tokio::main] #[cfg(debug_assertions)]
async fn main() { fn logs() {
use tracing_subscriber::{fmt, layer::SubscriberExt, util::SubscriberInitExt as _, EnvFilter};
tracing_subscriber::registry() tracing_subscriber::registry()
.with(fmt::layer()) .with(fmt::layer())
.with(EnvFilter::from_env("RUST_LOG")) .with(EnvFilter::from_env("RUST_LOG"))
.init(); .init();
}
#[cfg(not(debug_assertions))]
fn logs() {
println!(
"
Logs is able in only debug mode. Start bot with command \"cargo run\"\n
Логи доступны только в режиме дебаг. Запустите бота командой \"cargo run\".
"
);
}
#[tokio::main]
async fn main() {
logs();
dotenv().ok(); dotenv().ok();
@ -37,7 +52,6 @@ async fn main() {
let bot = Bot::new(token); let bot = Bot::new(token);
let mut route = Router::new("main"); let mut route = Router::new("main");
let mut dice = Router::new("dice"); let mut dice = Router::new("dice");
dice.message dice.message