invert sense of an if statement

This commit is contained in:
Mike Dilger 2023-01-09 19:13:06 +13:00
parent a5fcf6e5b4
commit 1af959c970

View File

@ -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;
}
}
});