add linting CI jobs

This commit is contained in:
daniel.eades 2023-11-17 07:04:57 +00:00 committed by Ashley Wulber
parent 9974b2f99f
commit aa2d9fe374
12 changed files with 98 additions and 68 deletions

View file

@ -71,23 +71,22 @@ pub fn main() -> iced::Result {
path.push(&filename);
if let Ok(bytes) = fs::read_to_string(&path) {
if let Ok(entry) = DesktopEntry::decode(&path, &bytes) {
desktop = Some(Desktop {
name: entry
.name(None)
.map(|x| x.to_string())
.expect(&format!("Desktop file '{filename}' doesn't have `Name`")),
icon: entry.icon().map(|x| x.to_string()),
exec: entry
.exec()
.map(|x| x.to_string())
.expect(&format!("Desktop file '{filename}' doesn't have `Exec`")),
});
desktop =
Some(Desktop {
name: entry.name(None).map(|x| x.to_string()).unwrap_or_else(|| {
panic!("Desktop file '{filename}' doesn't have `Name`")
}),
icon: entry.icon().map(|x| x.to_string()),
exec: entry.exec().map(|x| x.to_string()).unwrap_or_else(|| {
panic!("Desktop file '{filename}' doesn't have `Exec`")
}),
});
break;
}
}
}
let desktop = desktop.expect(&format!(
"Failed to find valid desktop file '{filename}' in search paths"
));
let desktop = desktop.unwrap_or_else(|| {
panic!("Failed to find valid desktop file '{filename}' in search paths")
});
cosmic::applet::run::<Button>(true, desktop)
}