From 27f6abad678fc045692414e784ff2fc327792ac8 Mon Sep 17 00:00:00 2001 From: Jake Stanger Date: Sun, 16 Oct 2022 13:54:48 +0100 Subject: [PATCH] chore: format and fix clippy warnings --- src/logging.rs | 3 ++- src/main.rs | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/logging.rs b/src/logging.rs index 87f18da..c600c94 100644 --- a/src/logging.rs +++ b/src/logging.rs @@ -32,7 +32,8 @@ impl<'a> MakeWriter<'a> for MakeFileWriter { /// for the lifetime of the application for logging to file to work. pub fn install_tracing() -> Result { let fmt_layer = fmt::layer().with_target(true); - let filter_layer = EnvFilter::try_from_env("IRONBAR_LOG").or_else(|_| EnvFilter::try_new("info"))?; + let filter_layer = + EnvFilter::try_from_env("IRONBAR_LOG").or_else(|_| EnvFilter::try_new("info"))?; let file_filter_layer = EnvFilter::try_from_env("IRONBAR_FILE_LOG").or_else(|_| EnvFilter::try_new("warn"))?; diff --git a/src/main.rs b/src/main.rs index 8e35a95..1e10a3a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -19,23 +19,23 @@ use dirs::config_dir; use gtk::gdk::Display; use gtk::prelude::*; use gtk::Application; -use std::{env, panic}; use std::future::Future; use std::process::exit; +use std::{env, panic}; use tokio::runtime::Handle; use tokio::task::block_in_place; use crate::logging::install_tracing; -use tracing::{debug, error, info, warn}; +use tracing::{debug, error, info}; use wayland::WaylandClient; const VERSION: &str = env!("CARGO_PKG_VERSION"); #[repr(i32)] -enum ExitCode { - ErrGtkDisplay = 1, - ErrCreateBars = 2, - ErrConfig = 3 +enum ErrorCode { + GtkDisplay = 1, + CreateBars = 2, + Config = 3, } #[tokio::main] @@ -56,7 +56,7 @@ async fn main() -> Result<()> { // custom hook allows tracing_appender to capture panics panic::set_hook(Box::new(move |panic_info| { - error!("{}", panic_hook.panic_report(panic_info)) + error!("{}", panic_hook.panic_report(panic_info)); })); info!("Ironbar version {}", VERSION); @@ -73,7 +73,7 @@ async fn main() -> Result<()> { || { let report = Report::msg("Failed to get default GTK display"); error!("{:?}", report); - exit(ExitCode::ErrGtkDisplay as i32) + exit(ErrorCode::GtkDisplay as i32) }, |display| display, ); @@ -82,14 +82,14 @@ async fn main() -> Result<()> { Ok(config) => config, Err(err) => { error!("{:?}", err); - exit(ExitCode::ErrConfig as i32) + exit(ErrorCode::Config as i32) } }; debug!("Loaded config file"); if let Err(err) = create_bars(app, &display, wayland_client, &config) { error!("{:?}", err); - exit(ExitCode::ErrCreateBars as i32); + exit(ErrorCode::CreateBars as i32); } debug!("Created bars"); @@ -98,7 +98,7 @@ async fn main() -> Result<()> { || { let report = Report::msg("Failed to locate user config dir"); error!("{:?}", report); - exit(ExitCode::ErrCreateBars as i32); + exit(ErrorCode::CreateBars as i32); }, |dir| dir.join("ironbar").join("style.css"), );