Skip to content

Commit b5987b0

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

File tree

31 files changed

+546
-685
lines changed

31 files changed

+546
-685
lines changed

cosmic-app-list/src/app.rs

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

17151715
let mut content = match &self.core.applet.anchor {
17161716
PanelAnchor::Left | PanelAnchor::Right => container(
1717-
Column::with_children(content_list)
1717+
Column::from_vec(content_list)
17181718
.spacing(4.0)
17191719
.align_x(Alignment::Center)
17201720
.height(h)
17211721
.width(w),
17221722
),
17231723
PanelAnchor::Top | PanelAnchor::Bottom => container(
1724-
Row::with_children(content_list)
1724+
Row::from_vec(content_list)
17251725
.spacing(4.0)
17261726
.align_y(Alignment::Center)
17271727
.height(h)
@@ -2032,14 +2032,14 @@ impl cosmic::Application for CosmicAppList {
20322032
.collect();
20332033
let content = match &self.core.applet.anchor {
20342034
PanelAnchor::Left | PanelAnchor::Right => container(
2035-
Column::with_children(active)
2035+
Column::from_vec(active)
20362036
.spacing(4.0)
20372037
.align_x(Alignment::Center)
20382038
.width(Length::Shrink)
20392039
.height(Length::Shrink),
20402040
),
20412041
PanelAnchor::Top | PanelAnchor::Bottom => container(
2042-
Row::with_children(active)
2042+
Row::from_vec(active)
20432043
.spacing(4.0)
20442044
.align_y(Alignment::Center)
20452045
.width(Length::Shrink)
@@ -2135,14 +2135,14 @@ impl cosmic::Application for CosmicAppList {
21352135
.collect();
21362136
let content = match &self.core.applet.anchor {
21372137
PanelAnchor::Left | PanelAnchor::Right => container(
2138-
Column::with_children(favorites)
2138+
Column::from_vec(favorites)
21392139
.spacing(4.0)
21402140
.align_x(Alignment::Center)
21412141
.width(Length::Shrink)
21422142
.height(Length::Shrink),
21432143
),
21442144
PanelAnchor::Top | PanelAnchor::Bottom => container(
2145-
Row::with_children(favorites)
2145+
Row::from_vec(favorites)
21462146
.spacing(4.0)
21472147
.align_y(Alignment::Center)
21482148
.width(Length::Shrink)
@@ -2240,7 +2240,7 @@ impl CosmicAppList {
22402240
}) else {
22412241
return (None, active_index);
22422242
};
2243-
// tracing::error!("{} {}", max_major_axis_len, self.pinned_list.len());
2243+
// tracing::error!("{max_major_axis_len} {}", self.pinned_list.len());
22442244
// subtract the divider width
22452245
max_major_axis_len -= 1;
22462246
let applet_icon = AppletIconData::new(&self.core.applet);
@@ -2279,7 +2279,7 @@ impl CosmicAppList {
22792279
} else {
22802280
favorite_index = (btn_count as usize).min(self.pinned_list.len());
22812281
}
2282-
// tracing::error!("{} {} {:?}", btn_count, favorite_index, active_index);
2282+
// tracing::error!("{btn_count} {favorite_index} {active_index:?}");
22832283
(Some(favorite_index), active_index)
22842284
}
22852285

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

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)