chore: apply recommendations from clippy

This commit is contained in:
Cheong Lau 2025-10-04 10:51:18 +10:00 committed by GitHub
parent cec55dafd7
commit 8e0f1c4a09
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
56 changed files with 720 additions and 824 deletions

View file

@ -125,12 +125,12 @@ impl cosmic::Application for Notifications {
core,
config_helper: helper,
config,
icon_name: Default::default(),
icon_name: String::default(),
popup: None,
timeline: Default::default(),
dbus_sender: Default::default(),
timeline: Timeline::default(),
dbus_sender: Option::default(),
cards: Vec::new(),
token_tx: Default::default(),
token_tx: Option::default(),
proxy: block_on(crate::subscriptions::notifications::get_proxy())
.expect("Failed to get proxy"),
notifications_tx: None,
@ -290,7 +290,7 @@ impl cosmic::Application for Notifications {
}
}
Message::ClearAll(None) => {
for n in self.cards.drain(..).map(|n| n.1).flatten() {
for n in self.cards.drain(..).flat_map(|n| n.1) {
if let Some(tx) = &self.dbus_sender {
let tx = tx.clone();
tokio::spawn(async move {
@ -365,7 +365,7 @@ impl cosmic::Application for Notifications {
{
Some(ActionId::Default.to_string())
} else {
notification.actions.get(0).map(|a| a.0.to_string())
notification.actions.first().map(|a| a.0.to_string())
};
let Some(action) = maybe_action else {
@ -392,12 +392,12 @@ impl cosmic::Application for Notifications {
cosmic::app::Action::Surface(a),
));
}
};
}
self.update_icon();
Task::none()
}
fn view(&self) -> Element<Message> {
fn view(&self) -> Element<'_, Message> {
self.core
.applet
.icon_button(&self.icon_name)
@ -405,7 +405,7 @@ impl cosmic::Application for Notifications {
.into()
}
fn view_window(&self, _id: window::Id) -> Element<Message> {
fn view_window(&self, _id: window::Id) -> Element<'_, Message> {
let Spacing {
space_xxs, space_s, ..
} = theme::active().cosmic().spacing;
@ -423,7 +423,7 @@ impl cosmic::Application for Notifications {
]);
let notifications = if self.cards.is_empty() {
let no_notifications = String::from(fl!("no-notifications"));
let no_notifications = fl!("no-notifications");
row![
container(
column![

View file

@ -43,6 +43,6 @@ pub fn localize() {
let requested_languages = i18n_embed::DesktopLanguageRequester::requested_languages();
if let Err(error) = localizer.select(&requested_languages) {
eprintln!("Error while loading language for App List {}", error);
eprintln!("Error while loading language for App List {error}");
}
}

View file

@ -66,7 +66,7 @@ pub fn notifications(proxy: NotificationsAppletProxy<'static>) -> Subscription<O
std::process::exit(0);
} else {
tokio::time::sleep(std::time::Duration::from_secs(1)).await;
};
}
continue;
}
}
@ -101,10 +101,10 @@ pub fn notifications(proxy: NotificationsAppletProxy<'static>) -> Subscription<O
}
v = next_input => {
if let Some(Input::Activated(id, action)) = v {
if let Err(err) = proxy.invoke_action(id, action.clone()).await {
if proxy.invoke_action(id, action.clone()).await.is_err() {
tracing::error!("Failed to invoke action {id} {action}");
} else {
tracing::error!("Invoked {action} for {id}")
tracing::error!("Invoked {action} for {id}");
}
} else {
tracing::error!("Channel closed, ending notifications subscription");