From 1af959c9705f20cb99532b156b0cea4f2e9effc0 Mon Sep 17 00:00:00 2001 From: Mike Dilger Date: Mon, 9 Jan 2023 19:13:06 +1300 Subject: [PATCH] invert sense of an if statement --- src/ui/settings.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/ui/settings.rs b/src/ui/settings.rs index ad567ced..2d405c6d 100644 --- a/src/ui/settings.rs +++ b/src/ui/settings.rs @@ -111,16 +111,7 @@ pub(super) fn update( ui.horizontal(|ui| { ui.label("Switch to"); #[allow(clippy::collapsible_else_if)] - if ! app.settings.light_mode { - if ui - .add(Button::new("☀ Light")) - .on_hover_text("Switch to light mode") - .clicked() - { - ui.ctx().set_visuals(super::style::light_mode_visuals()); - app.settings.light_mode = true; - } - } else { + if app.settings.light_mode { if ui .add(Button::new("🌙 Dark")) .on_hover_text("Switch to dark mode") @@ -129,6 +120,15 @@ pub(super) fn update( ui.ctx().set_visuals(super::style::dark_mode_visuals()); app.settings.light_mode = false; } + } else { + if ui + .add(Button::new("☀ Light")) + .on_hover_text("Switch to light mode") + .clicked() + { + ui.ctx().set_visuals(super::style::light_mode_visuals()); + app.settings.light_mode = true; + } } });