Skip to content

Commit

Permalink
chore: fmt + clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
oknozor committed Jul 3, 2023
1 parent 82b3cf9 commit 177d189
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/app/entries/db_entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}
3 changes: 1 addition & 2 deletions src/app/entries/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
6 changes: 2 additions & 4 deletions src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ impl Onagre<'_> {
.filter(|entry| !entry.starts_with('%'))
.collect::<Vec<&String>>();

std::process::Command::new(&args[0])
std::process::Command::new(args[0])
.args(&args[1..])
.spawn()
.expect("Command failure");
Expand Down Expand Up @@ -418,9 +418,7 @@ impl Onagre<'_> {
fn snap(&mut self) -> Command<Message> {
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 })
Expand Down
9 changes: 2 additions & 7 deletions src/app/mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ use pop_launcher_toolkit::plugins::web::Config as WebConfig;

pub(crate) static WEB_CONFIG: Lazy<WebConfig> = Lazy::new(pop_launcher_toolkit::plugins::web::load);

#[derive(Debug, PartialEq, Clone)]
#[derive(Debug, PartialEq, Clone, Default)]
pub enum ActiveMode {
#[default]
History,
DesktopEntry,
Web {
Expand Down Expand Up @@ -33,9 +34,3 @@ impl From<QueryData> for ActiveMode {
}
}
}

impl Default for ActiveMode {
fn default() -> Self {
ActiveMode::History
}
}
4 changes: 2 additions & 2 deletions src/app/style/scrollable/scroller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ impl Default for ScrollerStyles {
}
}

impl Into<Scrollable> for &ScrollerStyles {
fn into(self) -> Scrollable {
impl From<&ScrollerStyles> for Scrollable {
fn from(_: &ScrollerStyles) -> Self {
Scrollable::Default
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/config/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Rule>),
Parse(#[from] Box<PestError<Rule>>),
#[error("Failed to parse number")]
ParseInt(#[from] ParseIntError),
#[error("Failed to parse number")]
Expand Down
3 changes: 2 additions & 1 deletion src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ struct ThemeParser;
pub fn parse_file<P: AsRef<Path>>(path: P) -> Result<Theme, ConfigError> {
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();

Expand Down

0 comments on commit 177d189

Please sign in to comment.