clippy
This commit is contained in:
+2
-1
@@ -373,13 +373,14 @@ fn load_icon() -> egui::IconData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::unnecessary_wraps)]
|
||||||
fn app_creator(
|
fn app_creator(
|
||||||
cc: &eframe::CreationContext<'_>,
|
cc: &eframe::CreationContext<'_>,
|
||||||
) -> Result<Box<dyn eframe::App>, Box<dyn std::error::Error + Send + Sync>> {
|
) -> Result<Box<dyn eframe::App>, Box<dyn std::error::Error + Send + Sync>> {
|
||||||
let mut app = Box::<App>::default();
|
let mut app = Box::<App>::default();
|
||||||
if let Some(persistent_state) = PersistentState::get() {
|
if let Some(persistent_state) = PersistentState::get() {
|
||||||
app.launch.selected = persistent_state.launcher;
|
app.launch.selected = persistent_state.launcher;
|
||||||
app.settings = persistent_state.settings.clone();
|
app.settings = persistent_state.settings;
|
||||||
};
|
};
|
||||||
let elevated = util::win::is_elevated();
|
let elevated = util::win::is_elevated();
|
||||||
if app.settings.start_elevated && !elevated {
|
if app.settings.start_elevated && !elevated {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ impl PersistentState {
|
|||||||
pub fn get() -> Option<Self> {
|
pub fn get() -> Option<Self> {
|
||||||
fs::read_to_string(CONFIG_PATH.as_path())
|
fs::read_to_string(CONFIG_PATH.as_path())
|
||||||
.ok()
|
.ok()
|
||||||
.and_then(|config| serde_json::from_str::<PersistentState>(&config).ok())
|
.and_then(|config| serde_json::from_str::<Self>(&config).ok())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set(&self) {
|
pub fn set(&self) {
|
||||||
|
|||||||
+10
-9
@@ -2,6 +2,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
use std::fmt::Display;
|
use std::fmt::Display;
|
||||||
use strum::EnumIter;
|
use strum::EnumIter;
|
||||||
|
|
||||||
|
#[allow(clippy::enum_variant_names)]
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize, EnumIter)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize, EnumIter)]
|
||||||
pub enum Theme {
|
pub enum Theme {
|
||||||
CatppuccinLatte,
|
CatppuccinLatte,
|
||||||
@@ -10,9 +11,9 @@ pub enum Theme {
|
|||||||
CatppuccinMocha,
|
CatppuccinMocha,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Into<catppuccin_egui::Theme> for Theme {
|
impl From<Theme> for catppuccin_egui::Theme {
|
||||||
fn into(self) -> catppuccin_egui::Theme {
|
fn from(val: Theme) -> Self {
|
||||||
match self {
|
match val {
|
||||||
Theme::CatppuccinLatte => catppuccin_egui::LATTE,
|
Theme::CatppuccinLatte => catppuccin_egui::LATTE,
|
||||||
Theme::CatppuccinFrappe => catppuccin_egui::FRAPPE,
|
Theme::CatppuccinFrappe => catppuccin_egui::FRAPPE,
|
||||||
Theme::CatppuccinMacchiato => catppuccin_egui::MACCHIATO,
|
Theme::CatppuccinMacchiato => catppuccin_egui::MACCHIATO,
|
||||||
@@ -24,18 +25,18 @@ impl Into<catppuccin_egui::Theme> for Theme {
|
|||||||
impl Display for Theme {
|
impl Display for Theme {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
let x = match self {
|
let x = match self {
|
||||||
Theme::CatppuccinLatte => "Catppuccin Latte",
|
Self::CatppuccinLatte => "Catppuccin Latte",
|
||||||
Theme::CatppuccinFrappe => "Catppuccin Frappe",
|
Self::CatppuccinFrappe => "Catppuccin Frappe",
|
||||||
Theme::CatppuccinMacchiato => "Catppuccin Macchiato",
|
Self::CatppuccinMacchiato => "Catppuccin Macchiato",
|
||||||
Theme::CatppuccinMocha => "Catppuccin Mocha",
|
Self::CatppuccinMocha => "Catppuccin Mocha",
|
||||||
};
|
};
|
||||||
write!(f, "{x}")
|
write!(f, "{x}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Theme {
|
impl Theme {
|
||||||
pub fn to_catppuccin(&self) -> catppuccin_egui::Theme {
|
pub fn to_catppuccin(self) -> catppuccin_egui::Theme {
|
||||||
(*self).into()
|
self.into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user