chore: apply recommendations from clippy
This commit is contained in:
parent
cec55dafd7
commit
8e0f1c4a09
56 changed files with 720 additions and 824 deletions
|
|
@ -88,25 +88,23 @@ impl Minimize {
|
|||
fn find_new_desktop_entry(&mut self, appid: &str) -> fde::DesktopEntry {
|
||||
let unicase_appid = fde::unicase::Ascii::new(appid);
|
||||
|
||||
let de = match fde::find_app_by_id(&self.desktop_entries, unicase_appid) {
|
||||
Some(de) => de,
|
||||
None => {
|
||||
// Update desktop entries in case it was not found.
|
||||
self.update_desktop_entries();
|
||||
match fde::find_app_by_id(&self.desktop_entries, unicase_appid) {
|
||||
Some(appid) => appid,
|
||||
None => {
|
||||
tracing::warn!(appid, "could not find desktop entry for app");
|
||||
let mut entry = fde::DesktopEntry {
|
||||
appid: appid.to_owned(),
|
||||
groups: Default::default(),
|
||||
path: Default::default(),
|
||||
ubuntu_gettext_domain: None,
|
||||
};
|
||||
entry.add_desktop_entry("Name".to_string(), appid.to_owned());
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
let de = if let Some(de) = fde::find_app_by_id(&self.desktop_entries, unicase_appid) {
|
||||
de
|
||||
} else {
|
||||
// Update desktop entries in case it was not found.
|
||||
self.update_desktop_entries();
|
||||
if let Some(appid) = fde::find_app_by_id(&self.desktop_entries, unicase_appid) {
|
||||
appid
|
||||
} else {
|
||||
tracing::warn!(appid, "could not find desktop entry for app");
|
||||
let mut entry = fde::DesktopEntry {
|
||||
appid: appid.to_owned(),
|
||||
groups: Default::default(),
|
||||
path: Default::default(),
|
||||
ubuntu_gettext_domain: None,
|
||||
};
|
||||
entry.add_desktop_entry("Name".to_string(), appid.to_owned());
|
||||
return entry;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -186,7 +184,7 @@ impl cosmic::Application for Minimize {
|
|||
.desktop_entry
|
||||
.icon()
|
||||
.unwrap_or(&apps[pos].desktop_entry.appid),
|
||||
)
|
||||
);
|
||||
}
|
||||
apps[pos].toplevel_info = toplevel_info;
|
||||
} else {
|
||||
|
|
@ -278,7 +276,7 @@ impl cosmic::Application for Minimize {
|
|||
cosmic::app::Action::Surface(a),
|
||||
));
|
||||
}
|
||||
};
|
||||
}
|
||||
Task::none()
|
||||
}
|
||||
|
||||
|
|
@ -286,17 +284,14 @@ impl cosmic::Application for Minimize {
|
|||
wayland_subscription::wayland_subscription().map(Message::Wayland)
|
||||
}
|
||||
|
||||
fn view(&self) -> Element<Self::Message> {
|
||||
let max_icon_count = self
|
||||
.max_icon_count()
|
||||
.map(|n| {
|
||||
if n < self.apps.len() {
|
||||
n - 1
|
||||
} else {
|
||||
self.apps.len()
|
||||
}
|
||||
})
|
||||
.unwrap_or(self.apps.len());
|
||||
fn view(&self) -> Element<'_, Self::Message> {
|
||||
let max_icon_count = self.max_icon_count().map_or(self.apps.len(), |n| {
|
||||
if n < self.apps.len() {
|
||||
n - 1
|
||||
} else {
|
||||
self.apps.len()
|
||||
}
|
||||
});
|
||||
let (width, _) = self.core.applet.suggested_size(false);
|
||||
let padding = self.core.applet.suggested_padding(false);
|
||||
let theme = self.core.system_theme().cosmic();
|
||||
|
|
@ -339,7 +334,7 @@ impl cosmic::Application for Minimize {
|
|||
|
||||
// TODO optional dividers on ends if detects app list neighbor
|
||||
// not sure the best way to tell if there is an adjacent app-list
|
||||
let icon_buttons = icon_buttons.chain(overflow_btn.into_iter());
|
||||
let icon_buttons = icon_buttons.chain(overflow_btn);
|
||||
let content: Element<_> = if matches!(
|
||||
self.core.applet.anchor,
|
||||
PanelAnchor::Top | PanelAnchor::Bottom
|
||||
|
|
@ -384,17 +379,14 @@ impl cosmic::Application for Minimize {
|
|||
.into()
|
||||
}
|
||||
|
||||
fn view_window(&self, _id: window::Id) -> Element<Self::Message> {
|
||||
let max_icon_count = self
|
||||
.max_icon_count()
|
||||
.map(|n| {
|
||||
if n < self.apps.len() {
|
||||
n - 1
|
||||
} else {
|
||||
self.apps.len()
|
||||
}
|
||||
})
|
||||
.unwrap_or(self.apps.len());
|
||||
fn view_window(&self, _id: window::Id) -> Element<'_, Self::Message> {
|
||||
let max_icon_count = self.max_icon_count().map_or(self.apps.len(), |n| {
|
||||
if n < self.apps.len() {
|
||||
n - 1
|
||||
} else {
|
||||
self.apps.len()
|
||||
}
|
||||
});
|
||||
let (width, _) = self.core.applet.suggested_size(false);
|
||||
let padding = self.core.applet.suggested_padding(false);
|
||||
let theme = self.core.system_theme().cosmic();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue