Lint
This commit is contained in:
parent
f1002712e9
commit
d8a3e8e93e
3 changed files with 9 additions and 11 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
use std::{ffi::OsString, io::IsTerminal};
|
use std::ffi::OsString;
|
||||||
|
|
||||||
use clap::{Parser, ValueEnum};
|
use clap::Parser;
|
||||||
use clap_verbosity_flag::{InfoLevel, Verbosity};
|
use clap_verbosity_flag::{InfoLevel, Verbosity};
|
||||||
|
|
||||||
use crate::cli::color_when::ColorWhen;
|
use crate::cli::color_when::ColorWhen;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use std::{ffi::OsString, io::IsTerminal};
|
use std::io::IsTerminal;
|
||||||
|
|
||||||
use clap::{Parser, ValueEnum};
|
use clap::ValueEnum;
|
||||||
|
|
||||||
#[derive(ValueEnum, Copy, Clone, Debug, PartialEq, Eq)]
|
#[derive(ValueEnum, Copy, Clone, Debug, PartialEq, Eq)]
|
||||||
pub enum ColorWhen {
|
pub enum ColorWhen {
|
||||||
|
|
@ -10,7 +10,7 @@ pub enum ColorWhen {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ColorWhen {
|
impl ColorWhen {
|
||||||
pub fn use_colors(&self) -> bool {
|
pub fn use_colors(self) -> bool {
|
||||||
match self {
|
match self {
|
||||||
ColorWhen::Always => true,
|
ColorWhen::Always => true,
|
||||||
ColorWhen::Auto => {
|
ColorWhen::Auto => {
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ use cli::args::Args;
|
||||||
use errors::{SyncServerError, init_error};
|
use errors::{SyncServerError, init_error};
|
||||||
use log::info;
|
use log::info;
|
||||||
use server::create_server;
|
use server::create_server;
|
||||||
use tracing_subscriber::{EnvFilter, fmt::format, layer::SubscriberExt, util::SubscriberInitExt};
|
use tracing_subscriber::{EnvFilter, fmt::format, util::SubscriberInitExt};
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> ExitCode {
|
async fn main() -> ExitCode {
|
||||||
|
|
@ -27,9 +27,9 @@ async fn main() -> ExitCode {
|
||||||
}
|
}
|
||||||
|
|
||||||
match result {
|
match result {
|
||||||
Ok(_) => ExitCode::SUCCESS,
|
Ok(()) => ExitCode::SUCCESS,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
eprintln!("Failed to set up logging: {}", e);
|
eprintln!("Failed to set up logging: {e}");
|
||||||
ExitCode::FAILURE
|
ExitCode::FAILURE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -38,9 +38,7 @@ async fn main() -> ExitCode {
|
||||||
fn set_up_logging(args: &Args) -> Result<(), SyncServerError> {
|
fn set_up_logging(args: &Args) -> Result<(), SyncServerError> {
|
||||||
let level_filter = match args.verbose.log_level_filter() {
|
let level_filter = match args.verbose.log_level_filter() {
|
||||||
// We don't want to allow disabling all logging
|
// We don't want to allow disabling all logging
|
||||||
log::LevelFilter::Off => tracing::Level::ERROR,
|
log::LevelFilter::Off | log::LevelFilter::Error => tracing::Level::ERROR,
|
||||||
|
|
||||||
log::LevelFilter::Error => tracing::Level::ERROR,
|
|
||||||
log::LevelFilter::Warn => tracing::Level::WARN,
|
log::LevelFilter::Warn => tracing::Level::WARN,
|
||||||
log::LevelFilter::Info => tracing::Level::INFO,
|
log::LevelFilter::Info => tracing::Level::INFO,
|
||||||
log::LevelFilter::Debug => tracing::Level::DEBUG,
|
log::LevelFilter::Debug => tracing::Level::DEBUG,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue