diff options
| author | Fuwn <[email protected]> | 2021-05-26 22:17:09 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2021-05-26 22:17:09 +0000 |
| commit | cb8389b0492020e22046d005289dd2b51b6d7679 (patch) | |
| tree | d0d8c01f57d206a7c1f4f406c37ffb8b1a9e8ff9 | |
| parent | style(whirl): don't use single used trait (diff) | |
| download | whirl-cb8389b0492020e22046d005289dd2b51b6d7679.tar.xz whirl-cb8389b0492020e22046d005289dd2b51b6d7679.zip | |
style(whirl): remove more singleton use statements
| -rw-r--r-- | crates/whirl/src/cli.rs | 6 | ||||
| -rw-r--r-- | crates/whirl/src/main.rs | 4 | ||||
| -rw-r--r-- | crates/whirl/src/whirl.rs | 11 |
3 files changed, 6 insertions, 15 deletions
diff --git a/crates/whirl/src/cli.rs b/crates/whirl/src/cli.rs index a909c9f..05850d6 100644 --- a/crates/whirl/src/cli.rs +++ b/crates/whirl/src/cli.rs @@ -2,9 +2,7 @@ // SPDX-License-Identifier: GPL-3.0-only use structopt::clap::{App, AppSettings, Arg, SubCommand}; -use whirl_api::Api; use whirl_config::Config; -use whirl_prompt::Prompt; use whirl_server::{ distributor::Distributor, hub::Hub, @@ -86,7 +84,7 @@ impl Cli { let _ = Hub::listen(&*format!("0.0.0.0:{}", Config::get().hub.port), RoomServer).await; }), tokio::spawn(async move { - let _ = Api::listen( + let _ = whirl_api::Api::listen( tx, &*format!("0.0.0.0:{}", Config::get().whirlsplash.api.port), ) @@ -102,7 +100,7 @@ impl Cli { std::thread::sleep(std::time::Duration::default()); } } else { - Prompt::handle().await; + whirl_prompt::Prompt::handle().await; } // actix_web::rt::System::new("").block_on(rx.recv().unwrap().stop(true)); diff --git a/crates/whirl/src/main.rs b/crates/whirl/src/main.rs index 04c516c..8aa7ceb 100644 --- a/crates/whirl/src/main.rs +++ b/crates/whirl/src/main.rs @@ -1,7 +1,5 @@ // Copyleft (ɔ) 2021-2021 The Whirlsplash Collective // SPDX-License-Identifier: GPL-3.0-only -use whirl::whirl::Whirl; - #[tokio::main] -async fn main() -> Result<(), Box<dyn std::error::Error>> { Whirl::splash().await } +async fn main() -> Result<(), Box<dyn std::error::Error>> { whirl::whirl::Whirl::splash().await } diff --git a/crates/whirl/src/whirl.rs b/crates/whirl/src/whirl.rs index 359a5ff..f422c4f 100644 --- a/crates/whirl/src/whirl.rs +++ b/crates/whirl/src/whirl.rs @@ -1,16 +1,11 @@ // Copyleft (ɔ) 2021-2021 The Whirlsplash Collective // SPDX-License-Identifier: GPL-3.0-only -use std::error::Error; - -use whirl_common::log::calculate_log_level; use whirl_config::Config; -use crate::cli::Cli; - pub struct Whirl; impl Whirl { - pub async fn splash() -> Result<(), Box<dyn Error>> { + pub async fn splash() -> Result<(), Box<dyn std::error::Error>> { // Environment std::env::set_var("DATABASE_URL", "whirl.sqlite3"); @@ -18,7 +13,7 @@ impl Whirl { dotenv::dotenv().ok(); human_panic::setup_panic!(); if Config::get().whirlsplash.log.enable { - let logger = flexi_logger::Logger::with_str(calculate_log_level()); + let logger = flexi_logger::Logger::with_str(whirl_common::log::calculate_log_level()); if std::env::var("LOG_FILE").unwrap_or_else(|_| "true".to_string()) == "false" || !whirl_config::Config::get().whirlsplash.log.file || std::env::args().collect::<Vec<_>>()[1] == "clean" @@ -34,7 +29,7 @@ impl Whirl { } } - Cli::execute().await.unwrap(); + crate::cli::Cli::execute().await.unwrap(); Ok(()) } |