mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-07-01 10:41:03 +02:00
chore: format and fix clippy warnings
This commit is contained in:
parent
ec1d59677b
commit
27f6abad67
2 changed files with 13 additions and 12 deletions
|
@ -32,7 +32,8 @@ impl<'a> MakeWriter<'a> for MakeFileWriter {
|
||||||
/// for the lifetime of the application for logging to file to work.
|
/// for the lifetime of the application for logging to file to work.
|
||||||
pub fn install_tracing() -> Result<WorkerGuard> {
|
pub fn install_tracing() -> Result<WorkerGuard> {
|
||||||
let fmt_layer = fmt::layer().with_target(true);
|
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 =
|
let file_filter_layer =
|
||||||
EnvFilter::try_from_env("IRONBAR_FILE_LOG").or_else(|_| EnvFilter::try_new("warn"))?;
|
EnvFilter::try_from_env("IRONBAR_FILE_LOG").or_else(|_| EnvFilter::try_new("warn"))?;
|
||||||
|
|
22
src/main.rs
22
src/main.rs
|
@ -19,23 +19,23 @@ use dirs::config_dir;
|
||||||
use gtk::gdk::Display;
|
use gtk::gdk::Display;
|
||||||
use gtk::prelude::*;
|
use gtk::prelude::*;
|
||||||
use gtk::Application;
|
use gtk::Application;
|
||||||
use std::{env, panic};
|
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use std::process::exit;
|
use std::process::exit;
|
||||||
|
use std::{env, panic};
|
||||||
use tokio::runtime::Handle;
|
use tokio::runtime::Handle;
|
||||||
use tokio::task::block_in_place;
|
use tokio::task::block_in_place;
|
||||||
|
|
||||||
use crate::logging::install_tracing;
|
use crate::logging::install_tracing;
|
||||||
use tracing::{debug, error, info, warn};
|
use tracing::{debug, error, info};
|
||||||
use wayland::WaylandClient;
|
use wayland::WaylandClient;
|
||||||
|
|
||||||
const VERSION: &str = env!("CARGO_PKG_VERSION");
|
const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||||
|
|
||||||
#[repr(i32)]
|
#[repr(i32)]
|
||||||
enum ExitCode {
|
enum ErrorCode {
|
||||||
ErrGtkDisplay = 1,
|
GtkDisplay = 1,
|
||||||
ErrCreateBars = 2,
|
CreateBars = 2,
|
||||||
ErrConfig = 3
|
Config = 3,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
|
@ -56,7 +56,7 @@ async fn main() -> Result<()> {
|
||||||
|
|
||||||
// custom hook allows tracing_appender to capture panics
|
// custom hook allows tracing_appender to capture panics
|
||||||
panic::set_hook(Box::new(move |panic_info| {
|
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);
|
info!("Ironbar version {}", VERSION);
|
||||||
|
@ -73,7 +73,7 @@ async fn main() -> Result<()> {
|
||||||
|| {
|
|| {
|
||||||
let report = Report::msg("Failed to get default GTK display");
|
let report = Report::msg("Failed to get default GTK display");
|
||||||
error!("{:?}", report);
|
error!("{:?}", report);
|
||||||
exit(ExitCode::ErrGtkDisplay as i32)
|
exit(ErrorCode::GtkDisplay as i32)
|
||||||
},
|
},
|
||||||
|display| display,
|
|display| display,
|
||||||
);
|
);
|
||||||
|
@ -82,14 +82,14 @@ async fn main() -> Result<()> {
|
||||||
Ok(config) => config,
|
Ok(config) => config,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
error!("{:?}", err);
|
error!("{:?}", err);
|
||||||
exit(ExitCode::ErrConfig as i32)
|
exit(ErrorCode::Config as i32)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
debug!("Loaded config file");
|
debug!("Loaded config file");
|
||||||
|
|
||||||
if let Err(err) = create_bars(app, &display, wayland_client, &config) {
|
if let Err(err) = create_bars(app, &display, wayland_client, &config) {
|
||||||
error!("{:?}", err);
|
error!("{:?}", err);
|
||||||
exit(ExitCode::ErrCreateBars as i32);
|
exit(ErrorCode::CreateBars as i32);
|
||||||
}
|
}
|
||||||
|
|
||||||
debug!("Created bars");
|
debug!("Created bars");
|
||||||
|
@ -98,7 +98,7 @@ async fn main() -> Result<()> {
|
||||||
|| {
|
|| {
|
||||||
let report = Report::msg("Failed to locate user config dir");
|
let report = Report::msg("Failed to locate user config dir");
|
||||||
error!("{:?}", report);
|
error!("{:?}", report);
|
||||||
exit(ExitCode::ErrCreateBars as i32);
|
exit(ErrorCode::CreateBars as i32);
|
||||||
},
|
},
|
||||||
|dir| dir.join("ironbar").join("style.css"),
|
|dir| dir.join("ironbar").join("style.css"),
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue