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

@ -88,7 +88,7 @@ pub fn spawn_workspaces(tx: mpsc::Sender<TilingState>) -> SyncSender<AppRequest>
};
let loop_handle = event_loop.handle();
loop_handle
.insert_source(workspaces_rx, |e, _, state| match e {
.insert_source(workspaces_rx, |e, (), state| match e {
Event::Msg(AppRequest::TilingState(autotile)) => {
if let Some(w) = state.workspace_state.workspace_groups().find_map(|g| {
if let Some(o) = state.expected_output.as_ref() {
@ -183,9 +183,10 @@ impl State {
.filter_map(|handle| self.workspace_state.workspace_info(handle))
.find_map(|w| {
if w.state.contains(ext_workspace_handle_v1::State::Active) {
w.tiling.and_then(|e| match e {
WEnum::Value(v) => Some(v),
_ => {
w.tiling.and_then(|e| {
if let WEnum::Value(v) = e {
Some(v)
} else {
error!("No tiling state for the workspace");
None
}
@ -273,7 +274,7 @@ impl ToplevelInfoHandler for State {
) {
let Some(w) = self
.toplevel_info_state
.info(&toplevel)
.info(toplevel)
.map(|t| t.workspace.clone())
else {
return;
@ -289,7 +290,7 @@ impl ToplevelInfoHandler for State {
) {
let Some(w) = self
.toplevel_info_state
.info(&toplevel)
.info(toplevel)
.map(|t| t.workspace.clone())
else {
return;

View file

@ -80,6 +80,6 @@ impl WorkspacesWatcher {
pub fn new() -> anyhow::Result<Self> {
let (tx, rx) = mpsc::channel(20);
let tx = wayland::spawn_workspaces(tx);
Ok(Self { tx, rx })
Ok(Self { rx, tx })
}
}

View file

@ -110,7 +110,7 @@ impl cosmic::Application for Window {
let window = Self {
core,
popup: None,
timeline: Default::default(),
timeline: Timeline::default(),
autotiled: config.autotile,
config,
config_helper,
@ -202,7 +202,7 @@ impl cosmic::Application for Window {
};
if let Err(err) = tx.send(AppRequest::TilingState(state)) {
error!("Failed to send the tiling state update. {err:?}")
error!("Failed to send the tiling state update. {err:?}");
}
}
}
@ -223,16 +223,14 @@ impl cosmic::Application for Window {
.activate_position(if c.autotile { 0 } else { 1 });
}
if c.active_hint != self.config.active_hint {
if self.popup.is_some() {
self.timeline
.set_chain(if c.active_hint {
cosmic_time::chain::Toggler::on(self.active_hint.clone(), 1.0)
} else {
cosmic_time::chain::Toggler::off(self.active_hint.clone(), 1.0)
})
.start();
}
if c.active_hint != self.config.active_hint && self.popup.is_some() {
self.timeline
.set_chain(if c.active_hint {
cosmic_time::chain::Toggler::on(self.active_hint.clone(), 1.0)
} else {
cosmic_time::chain::Toggler::off(self.active_hint.clone(), 1.0)
})
.start();
}
self.config = *c;
@ -252,7 +250,7 @@ impl cosmic::Application for Window {
};
if let Err(err) = tx.send(AppRequest::DefaultBehavior(state)) {
error!("Failed to send the tiling state update. {err:?}")
error!("Failed to send the tiling state update. {err:?}");
}
}
@ -276,7 +274,7 @@ impl cosmic::Application for Window {
Task::none()
}
fn view(&self) -> Element<Self::Message> {
fn view(&self) -> Element<'_, Self::Message> {
self.core
.applet
.icon_button(if self.autotiled { ON } else { OFF })
@ -284,7 +282,7 @@ impl cosmic::Application for Window {
.into()
}
fn view_window(&self, _id: Id) -> Element<Self::Message> {
fn view_window(&self, _id: Id) -> Element<'_, Self::Message> {
let Spacing {
space_xxxs,
space_xxs,