diff --git a/src/app/entries/db_entry.rs b/src/app/entries/db_entry.rs index 23445a2..0e83e0d 100644 --- a/src/app/entries/db_entry.rs +++ b/src/app/entries/db_entry.rs @@ -113,7 +113,7 @@ fn ico_to_png(path: PathBuf) { } Err(_) => { // We were unable to read the icon, it's probably a png - std::fs::copy(&path, &path.with_extension("png")).unwrap(); + std::fs::copy(&path, path.with_extension("png")).unwrap(); } } } diff --git a/src/app/entries/mod.rs b/src/app/entries/mod.rs index bd19dd6..4b060da 100644 --- a/src/app/entries/mod.rs +++ b/src/app/entries/mod.rs @@ -3,8 +3,7 @@ use crate::app::style::rows::RowStyles; use crate::app::Message; use crate::icons::{fallback_icon, Extension, IconPath}; use crate::THEME; -use iced::widget::Row; -use iced::widget::{Container, Image}; +use iced::widget::{Container, Image, Row}; use iced::{Alignment, Length, Renderer}; use iced_native::row; use iced_native::widget::{column, container, text}; diff --git a/src/app/mod.rs b/src/app/mod.rs index dfda8fc..8bd6eaf 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -381,7 +381,7 @@ impl Onagre<'_> { .filter(|entry| !entry.starts_with('%')) .collect::>(); - std::process::Command::new(&args[0]) + std::process::Command::new(args[0]) .args(&args[1..]) .spawn() .expect("Command failure"); @@ -418,9 +418,7 @@ impl Onagre<'_> { fn snap(&mut self) -> Command { let total_items = self.current_entries_len() as f32; match self.selected() { - None => { - scrollable::snap_to(SCROLL_ID.clone(), RelativeOffset::START) - } + None => scrollable::snap_to(SCROLL_ID.clone(), RelativeOffset::START), Some(selected) => { let offset = (1.0 / total_items) * selected as f32; scrollable::snap_to(SCROLL_ID.clone(), RelativeOffset { x: 0.0, y: offset }) diff --git a/src/app/mode.rs b/src/app/mode.rs index ff87f5a..65ee64b 100644 --- a/src/app/mode.rs +++ b/src/app/mode.rs @@ -4,8 +4,9 @@ use pop_launcher_toolkit::plugins::web::Config as WebConfig; pub(crate) static WEB_CONFIG: Lazy = Lazy::new(pop_launcher_toolkit::plugins::web::load); -#[derive(Debug, PartialEq, Clone)] +#[derive(Debug, PartialEq, Clone, Default)] pub enum ActiveMode { + #[default] History, DesktopEntry, Web { @@ -33,9 +34,3 @@ impl From for ActiveMode { } } } - -impl Default for ActiveMode { - fn default() -> Self { - ActiveMode::History - } -} diff --git a/src/app/style/scrollable/scroller.rs b/src/app/style/scrollable/scroller.rs index ea59bee..fc61287 100644 --- a/src/app/style/scrollable/scroller.rs +++ b/src/app/style/scrollable/scroller.rs @@ -39,8 +39,8 @@ impl Default for ScrollerStyles { } } -impl Into for &ScrollerStyles { - fn into(self) -> Scrollable { +impl From<&ScrollerStyles> for Scrollable { + fn from(_: &ScrollerStyles) -> Self { Scrollable::Default } } diff --git a/src/config/error.rs b/src/config/error.rs index b0c81a7..537fb7d 100644 --- a/src/config/error.rs +++ b/src/config/error.rs @@ -9,7 +9,7 @@ pub enum ConfigError { #[error("Failed to open config file")] IO(#[from] io::Error), #[error("Failed to parse config file:\n{0}")] - Parse(#[from] PestError), + Parse(#[from] Box>), #[error("Failed to parse number")] ParseInt(#[from] ParseIntError), #[error("Failed to parse number")] diff --git a/src/config/mod.rs b/src/config/mod.rs index d7befb3..71776b1 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -30,7 +30,8 @@ struct ThemeParser; pub fn parse_file>(path: P) -> Result { let content = std::fs::read_to_string(path)?; - let pairs = ThemeParser::parse(Rule::stylesheet, &content)? + let pairs = ThemeParser::parse(Rule::stylesheet, &content) + .map_err(Box::new)? .next() .unwrap();