Skip to content

Commit

Permalink
chore: thanks clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
oknozor committed Dec 25, 2024
1 parent 7c42855 commit 5431bf9
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 23 deletions.
4 changes: 2 additions & 2 deletions src/app/entries/db_entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::db::web::WebEntity;
use crate::icons::{Extension, IconPath};
use crate::THEME;

impl<'a> AsEntry<'a> for DesktopEntryEntity<'_> {
impl AsEntry<'_> for DesktopEntryEntity<'_> {
fn get_display_name(&self) -> &str {
self.name.as_ref()
}
Expand Down Expand Up @@ -106,7 +106,7 @@ fn ico_to_png(path: PathBuf) {
for entry in icon.entries() {
if !entry.is_png() {
let image = entry.decode().unwrap();
let file = std::fs::File::create(&path.with_extension("png")).unwrap();
let file = std::fs::File::create(path.with_extension("png")).unwrap();
image.write_png(file).unwrap();
}
}
Expand Down
24 changes: 10 additions & 14 deletions src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,13 +323,11 @@ impl Onagre<'_> {
ActiveMode::Plugin { plugin_name, .. } => {
// Get user input as pop-entry
match selected {
None => {
return self
.state
.pop_search
.first()
.map(|entry| entry.name.clone());
}
None => self
.state
.pop_search
.first()
.map(|entry| entry.name.clone()),
Some(selected) => self
.state
.cache
Expand All @@ -341,13 +339,11 @@ impl Onagre<'_> {
ActiveMode::Web { modifier, .. } => {
// Get user input as pop-entry
match selected {
None => {
return self
.state
.pop_search
.first()
.map(|entry| entry.name.clone());
}
None => self
.state
.pop_search
.first()
.map(|entry| entry.name.clone()),
Some(selected) => self
.state
.cache
Expand Down
8 changes: 4 additions & 4 deletions src/config/color.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::config::error::ConfigError;
use iced::Color;
use std::num::ParseIntError;
use std::{fmt::Display, num::ParseIntError};

#[derive(Debug, Clone, PartialEq, Copy)]
pub struct OnagreColor {
Expand Down Expand Up @@ -111,8 +111,8 @@ impl OnagreColor {
}
}

impl ToString for OnagreColor {
fn to_string(&self) -> String {
impl Display for OnagreColor {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let r = (self.color.r * 255.0) as u32;
let g = (self.color.g * 255.0) as u32;
let b = (self.color.b * 255.0) as u32;
Expand All @@ -122,7 +122,7 @@ impl ToString for OnagreColor {
let g = to_lower_gex_with_leading_zero(g);
let b = to_lower_gex_with_leading_zero(b);
let a = to_lower_gex_with_leading_zero(a);
format!("#{}{}{}{}", r, g, b, a)
write!(f, "#{}{}{}{}", r, g, b, a)
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/config/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ mod test {
asserting!("Should parse 'border-color' attribute")
.that(&border_color)
.is_ok()
.is_equal_to(&OnagreColor::from("#ffffff").unwrap());
.is_equal_to(OnagreColor::from("#ffffff").unwrap());
}

#[test]
Expand All @@ -214,7 +214,7 @@ mod test {
asserting!("Should parse 'color' attribute")
.that(&color)
.is_ok()
.is_equal_to(&OnagreColor::from("#ffffff").unwrap());
.is_equal_to(OnagreColor::from("#ffffff").unwrap());
}

#[test]
Expand All @@ -229,7 +229,7 @@ mod test {
asserting!("Should parse 'background' attribute")
.that(&background)
.is_ok()
.is_equal_to(&OnagreColor::from("#ffffff").unwrap());
.is_equal_to(OnagreColor::from("#ffffff").unwrap());
}

#[test]
Expand Down

0 comments on commit 5431bf9

Please sign in to comment.