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

@ -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

@ -159,7 +159,7 @@ impl Window {
calendar
}
fn vertical_layout(&self) -> Element<Message> {
fn vertical_layout(&self) -> Element<'_, Message> {
let mut elements = Vec::new();
let date = self.now.naive_local();
let datetime = self.create_datetime(&date);
@ -216,7 +216,7 @@ impl Window {
)
}
fn horizontal_layout(&self) -> Element<Message> {
fn horizontal_layout(&self) -> Element<'_, Message> {
let datetime = self.create_datetime(&self.now);
let mut prefs = DateTimeFormatterPreferences::from(self.locale.clone());
prefs.hour_cycle = Some(if self.config.military_time {
@ -500,10 +500,10 @@ impl cosmic::Application for Window {
}
}
Message::Tick => {
self.now = self
.timezone
.map(|tz| chrono::Local::now().with_timezone(&tz).fixed_offset())
.unwrap_or_else(|| chrono::Local::now().into());
self.now = self.timezone.map_or_else(
|| chrono::Local::now().into(),
|tz| chrono::Local::now().with_timezone(&tz).fixed_offset(),
);
Task::none()
}
Message::Rectangle(u) => {
@ -523,8 +523,8 @@ impl cosmic::Application for Window {
}
Task::none()
}
Message::SelectDay(_day) => {
if let Some(date) = self.date_selected.with_day(_day) {
Message::SelectDay(day) => {
if let Some(date) = self.date_selected.with_day(day) {
self.date_selected = date;
} else {
tracing::error!("invalid naivedate");
@ -562,7 +562,7 @@ impl cosmic::Application for Window {
});
} else {
tracing::error!("Wayland tx is None");
};
}
Task::none()
}
Message::Token(u) => {
@ -616,7 +616,7 @@ impl cosmic::Application for Window {
}
}
fn view(&self) -> Element<Message> {
fn view(&self) -> Element<'_, Message> {
let horizontal = matches!(
self.core.applet.anchor,
PanelAnchor::Top | PanelAnchor::Bottom
@ -646,7 +646,7 @@ impl cosmic::Application for Window {
.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;