Fix not quitting when requested, cargo fmt

This commit is contained in:
Stephen Seo 2024-06-23 20:56:54 +09:00
parent 2f23e63349
commit 773587b664
2 changed files with 4 additions and 8 deletions

View file

@ -1,5 +1,5 @@
use std::fmt::Display;
use clap::ValueEnum; use clap::ValueEnum;
use std::fmt::Display;
#[derive(Copy, Clone, Debug, PartialEq, Eq)] #[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum LogState { pub enum LogState {

View file

@ -4,6 +4,7 @@ mod mpd_handler;
#[cfg(feature = "unicode_support")] #[cfg(feature = "unicode_support")]
mod unicode_support; mod unicode_support;
use clap::Parser;
use ggez::conf::{WindowMode, WindowSetup}; use ggez::conf::{WindowMode, WindowSetup};
use ggez::event::winit_event::{ElementState, KeyboardInput, ModifiersState}; use ggez::event::winit_event::{ElementState, KeyboardInput, ModifiersState};
use ggez::event::{self, ControlFlow, EventHandler}; use ggez::event::{self, ControlFlow, EventHandler};
@ -15,7 +16,6 @@ use std::net::Ipv4Addr;
use std::path::PathBuf; use std::path::PathBuf;
use std::thread; use std::thread;
use std::time::{Duration, Instant}; use std::time::{Duration, Instant};
use clap::Parser;
use debug_log::log; use debug_log::log;
@ -44,11 +44,7 @@ pub struct Opt {
help = "don't scale-fill the album art to the window" help = "don't scale-fill the album art to the window"
)] )]
do_not_fill_scale_album_art: bool, do_not_fill_scale_album_art: bool,
#[arg( #[arg(short = 'l', long = "log-level", default_value = "error")]
short = 'l',
long = "log-level",
default_value = "error",
)]
log_level: debug_log::LogLevel, log_level: debug_log::LogLevel,
#[arg( #[arg(
short, short,
@ -101,7 +97,7 @@ fn main() -> Result<(), String> {
let mut modifiers_state: ModifiersState = ModifiersState::default(); let mut modifiers_state: ModifiersState = ModifiersState::default();
event_loop.run(move |mut event, _window_target, control_flow| { event_loop.run(move |mut event, _window_target, control_flow| {
if !ctx.continuing { if !ctx.continuing || ctx.quit_requested {
*control_flow = ControlFlow::Exit; *control_flow = ControlFlow::Exit;
return; return;
} }