Skip to content

Commit a8b87ba

Browse files
committed
chore: apply clippy suggestions
Also some slight refactors for readability/minor performance.
1 parent 1d565fc commit a8b87ba

File tree

31 files changed

+518
-657
lines changed

31 files changed

+518
-657
lines changed

cosmic-app-list/src/app.rs

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1361,10 +1361,10 @@ impl cosmic::Application for CosmicAppList {
13611361
+ 4.0 * (popup_applet_count - 1.);
13621362
let (max_width, max_height) = match self.core.applet.anchor {
13631363
PanelAnchor::Top | PanelAnchor::Bottom => {
1364-
(popup_applet_size, applet_suggested_size as f32)
1364+
(popup_applet_size, applet_suggested_size.into())
13651365
}
13661366
PanelAnchor::Left | PanelAnchor::Right => {
1367-
(applet_suggested_size as f32, popup_applet_size)
1367+
(applet_suggested_size.into(), popup_applet_size)
13681368
}
13691369
};
13701370
popup_settings.positioner.size_limits = Limits::NONE
@@ -1715,14 +1715,14 @@ impl cosmic::Application for CosmicAppList {
17151715

17161716
let mut content = match &self.core.applet.anchor {
17171717
PanelAnchor::Left | PanelAnchor::Right => container(
1718-
Column::with_children(content_list)
1718+
Column::from_vec(content_list)
17191719
.spacing(4.0)
17201720
.align_x(Alignment::Center)
17211721
.height(h)
17221722
.width(w),
17231723
),
17241724
PanelAnchor::Top | PanelAnchor::Bottom => container(
1725-
Row::with_children(content_list)
1725+
Row::from_vec(content_list)
17261726
.spacing(4.0)
17271727
.align_y(Alignment::Center)
17281728
.height(h)
@@ -2033,14 +2033,14 @@ impl cosmic::Application for CosmicAppList {
20332033
.collect();
20342034
let content = match &self.core.applet.anchor {
20352035
PanelAnchor::Left | PanelAnchor::Right => container(
2036-
Column::with_children(active)
2036+
Column::from_vec(active)
20372037
.spacing(4.0)
20382038
.align_x(Alignment::Center)
20392039
.width(Length::Shrink)
20402040
.height(Length::Shrink),
20412041
),
20422042
PanelAnchor::Top | PanelAnchor::Bottom => container(
2043-
Row::with_children(active)
2043+
Row::from_vec(active)
20442044
.spacing(4.0)
20452045
.align_y(Alignment::Center)
20462046
.width(Length::Shrink)
@@ -2136,14 +2136,14 @@ impl cosmic::Application for CosmicAppList {
21362136
.collect();
21372137
let content = match &self.core.applet.anchor {
21382138
PanelAnchor::Left | PanelAnchor::Right => container(
2139-
Column::with_children(favorites)
2139+
Column::from_vec(favorites)
21402140
.spacing(4.0)
21412141
.align_x(Alignment::Center)
21422142
.width(Length::Shrink)
21432143
.height(Length::Shrink),
21442144
),
21452145
PanelAnchor::Top | PanelAnchor::Bottom => container(
2146-
Row::with_children(favorites)
2146+
Row::from_vec(favorites)
21472147
.spacing(4.0)
21482148
.align_y(Alignment::Center)
21492149
.width(Length::Shrink)
@@ -2241,7 +2241,7 @@ impl CosmicAppList {
22412241
}) else {
22422242
return (None, active_index);
22432243
};
2244-
// tracing::error!("{} {}", max_major_axis_len, self.pinned_list.len());
2244+
// tracing::error!("{max_major_axis_len} {}", self.pinned_list.len());
22452245
// subtract the divider width
22462246
max_major_axis_len -= 1;
22472247
let applet_icon = AppletIconData::new(&self.core.applet);
@@ -2280,7 +2280,7 @@ impl CosmicAppList {
22802280
} else {
22812281
favorite_index = (btn_count as usize).min(self.pinned_list.len());
22822282
}
2283-
// tracing::error!("{} {} {:?}", btn_count, favorite_index, active_index);
2283+
// tracing::error!("{btn_count} {favorite_index} {active_index:?}");
22842284
(Some(favorite_index), active_index)
22852285
}
22862286

@@ -2336,7 +2336,11 @@ impl CosmicAppList {
23362336
// in addition, try to match WINE entries who have its
23372337
// appid = the full name of the executable (incl. .exe)
23382338
let is_proton_game = info.app_id == "steam_app_default";
2339-
if is_proton_game || info.app_id.ends_with(".exe") {
2339+
if is_proton_game
2340+
|| PathBuf::from(info.app_id.clone())
2341+
.extension()
2342+
.is_some_and(|ext| ext.eq_ignore_ascii_case("exe"))
2343+
{
23402344
for entry in &self.desktop_entries {
23412345
let localised_name = entry.name(&self.locales).unwrap_or_default();
23422346

cosmic-app-list/src/wayland_handler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ impl CaptureData {
404404
// XXX
405405
if !formats.shm_formats.contains(&wl_shm::Format::Abgr8888) {
406406
tracing::error!("No suitable buffer format found");
407-
tracing::warn!("Available formats: {:#?}", formats);
407+
tracing::warn!("Available formats: {formats:#?}");
408408
return None;
409409
}
410410

cosmic-applet-a11y/src/app.rs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -147,22 +147,21 @@ impl cosmic::Application for CosmicA11yApplet {
147147
Message::TogglePopup => {
148148
if let Some(p) = self.popup.take() {
149149
return destroy_popup(p);
150-
} else {
151-
self.timeline = Timeline::new();
150+
}
151+
self.timeline = Timeline::new();
152152

153-
let new_id = window::Id::unique();
154-
self.popup.replace(new_id);
153+
let new_id = window::Id::unique();
154+
self.popup.replace(new_id);
155155

156-
let popup_settings = self.core.applet.get_popup_settings(
157-
self.core.main_window_id().unwrap(),
158-
new_id,
159-
Some((1, 1)),
160-
None,
161-
None,
162-
);
156+
let popup_settings = self.core.applet.get_popup_settings(
157+
self.core.main_window_id().unwrap(),
158+
new_id,
159+
Some((1, 1)),
160+
None,
161+
None,
162+
);
163163

164-
return get_popup(popup_settings);
165-
}
164+
return get_popup(popup_settings);
166165
}
167166
Message::CloseRequested(id) => {
168167
if Some(id) == self.popup {

cosmic-applet-a11y/src/backend/wayland/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
// SPDX-License-Identifier: GPL-3.0-only
33

44
use anyhow;
5-
use cctk::sctk::reexports::calloop::{self, channel::SyncSender};
5+
use cctk::sctk::reexports::calloop;
66
use cosmic::iced::{
77
self, Subscription,
8-
futures::{self, SinkExt, StreamExt, channel::mpsc},
8+
futures::{self, SinkExt},
99
stream,
1010
};
11-
use cosmic_protocols::a11y::v1::client::cosmic_a11y_manager_v1::Filter;
1211
use cosmic_settings_subscriptions::cosmic_a11y_manager::{
1312
self as thread, AccessibilityEvent, AccessibilityRequest,
1413
};

0 commit comments

Comments
 (0)