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

View File

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