1
0
Fork 0
forked from wry/wry

all: use let chains

This commit is contained in:
Julian Orth 2025-07-01 11:20:48 +02:00
parent 3d5d146d65
commit 286857971a
89 changed files with 1516 additions and 1574 deletions

View file

@ -1857,22 +1857,22 @@ impl ConfigClient {
run_cb("shortcut", &handler, ());
}
self.pressed_keysym.set(None);
if was_latched {
if let Entry::Occupied(mut oe) = self.key_handlers.borrow_mut().entry((seat, ms)) {
let o = oe.get_mut();
if o.latched.is_empty() {
if o.cb.is_none() {
self.send(&ClientMessage::RemoveShortcut { seat, mods, sym });
oe.remove();
} else if o.cb_mask != o.registered_mask {
o.registered_mask = o.cb_mask;
self.send(&ClientMessage::AddShortcut2 {
seat,
mods: ms.mods,
mod_mask: o.cb_mask,
sym: ms.sym,
});
}
if was_latched
&& let Entry::Occupied(mut oe) = self.key_handlers.borrow_mut().entry((seat, ms))
{
let o = oe.get_mut();
if o.latched.is_empty() {
if o.cb.is_none() {
self.send(&ClientMessage::RemoveShortcut { seat, mods, sym });
oe.remove();
} else if o.cb_mask != o.registered_mask {
o.registered_mask = o.cb_mask;
self.send(&ClientMessage::AddShortcut2 {
seat,
mods: ms.mods,
mod_mask: o.cb_mask,
sym: ms.sym,
});
}
}
}

View file

@ -441,10 +441,10 @@ impl ToConnectorId for &'_ str {
("USB-", CON_USB),
];
for (prefix, ty) in pairs {
if let Some(suffix) = self.strip_prefix(prefix) {
if let Ok(idx) = u32::from_str(suffix) {
return Ok((ty, idx));
}
if let Some(suffix) = self.strip_prefix(prefix)
&& let Ok(idx) = u32::from_str(suffix)
{
return Ok((ty, idx));
}
}
Err(format!("`{}` is not a valid connector identifier", self))