Clippy is a sick tool

This commit is contained in:
Javier Feliz 2025-09-06 01:03:37 -04:00
parent 0cd68cb58c
commit 85ce87449f
2 changed files with 21 additions and 15 deletions

View File

@ -15,11 +15,7 @@ impl LauncherListItem for DesktopEntry {
id: self.id.clone(),
title: self.name.to_owned(),
description: {
if let Some(glib_string) = &self.description {
Some(glib_string.to_string().to_owned())
} else {
None
}
self.description.as_ref().map(|glib_string| glib_string.to_string().to_owned())
},
icon: {
if let Some(icon) = &self.icon {
@ -57,11 +53,11 @@ pub fn get_desktop_entries() -> Vec<DesktopEntry> {
let mut entries = Vec::new();
for i in gio::AppInfo::all() {
let info: gio::DesktopAppInfo;
match i.downcast_ref::<gio::DesktopAppInfo>() {
Some(inf) => info = inf.to_owned(),
let info: gio::DesktopAppInfo = match i.downcast_ref::<gio::DesktopAppInfo>() {
Some(inf) => inf.to_owned(),
None => continue,
}
};
if !info.should_show() {
continue;
}
@ -83,6 +79,12 @@ pub fn get_desktop_entries() -> Vec<DesktopEntry> {
pub struct DrunPlugin;
impl Default for DrunPlugin {
fn default() -> Self {
Self::new()
}
}
impl DrunPlugin {
pub fn new() -> Self {
DrunPlugin

View File

@ -18,9 +18,9 @@ struct FileEntry {
impl FileEntry {
fn from(entry: DirEntry) -> Self {
return FileEntry {
FileEntry {
path: entry.into_path(),
};
}
}
}
@ -82,11 +82,9 @@ pub fn default_search_list() -> Vec<PathBuf> {
ud.video_dir(),
];
for d in user_dirs {
if let Some(path) = d {
for path in user_dirs.into_iter().flatten() {
paths.push(path.to_path_buf());
}
}
return paths;
}
@ -101,6 +99,12 @@ pub struct FileSearchPlugin {
files: Arc<Mutex<Vec<FileEntry>>>,
}
impl Default for FileSearchPlugin {
fn default() -> Self {
Self::new()
}
}
impl FileSearchPlugin {
pub fn new() -> Self {
FileSearchPlugin {