style: apply cargo fmt across workspace

This commit is contained in:
Karim Jerbi committed 2026-10-11 03:14:29 +01:00
1 parent 85710e5454
commit 9cf9ff2c5c
531 files changed
+57740 -33906

No files matched your search

+17 -17
View File
@@ -70,7 +70,11 @@ pub(super) fn normalize_key(value: &str) -> String {
let mut shift = false;
let mut key = String::new();
for part in value.split('+').map(str::trim).filter(|part| !part.is_empty()) {
for part in value
.split('+')
.map(str::trim)
.filter(|part| !part.is_empty())
{
match part.to_uppercase().as_str() {
"CTRL" | "CONTROL" => ctrl = true,
"CMD" | "COMMAND" | "META" | "SUPER" => cmd = true,
@@ -109,15 +113,11 @@ pub(super) fn normalize_key(value: &str) -> String {
/// intentionally stay out so text fields retain their native shortcuts.
pub(super) fn is_global_key(key: &str) -> bool {
let base = key.rsplit('+').next().unwrap_or(key);
base.strip_prefix('F').is_some_and(|digits| {
!digits.is_empty() && digits.chars().all(|ch| ch.is_ascii_digit())
})
base.strip_prefix('F')
.is_some_and(|digits| !digits.is_empty() && digits.chars().all(|ch| ch.is_ascii_digit()))
|| matches!(base, "ESCAPE")
|| (key.starts_with(ACCEL)
&& !matches!(
key.rsplit('+').next(),
Some("A" | "C" | "V" | "X")
))
&& !matches!(key.rsplit('+').next(), Some("A" | "C" | "V" | "X")))
}
fn is_named_key(key: &str) -> bool {
@@ -138,9 +138,9 @@ fn is_named_key(key: &str) -> bool {
| "PAGEUP"
| "PAGEDOWN"
| "INSERT"
) || key.strip_prefix('F').is_some_and(|digits| {
!digits.is_empty() && digits.chars().all(|ch| ch.is_ascii_digit())
})
) || key
.strip_prefix('F')
.is_some_and(|digits| !digits.is_empty() && digits.chars().all(|ch| ch.is_ascii_digit()))
}
/// Input actions `run_shortcut` resolves directly instead of routing through
@@ -213,9 +213,7 @@ impl OpenCADStudio {
/// Reset the working rows and live bindings to the shipped defaults.
pub(super) fn reset_shortcuts_to_defaults(&mut self) {
let mut rows: Vec<(String, String)> = default_bindings()
.into_iter()
.collect();
let mut rows: Vec<(String, String)> = default_bindings().into_iter().collect();
rows.sort_by(|a, b| a.0.cmp(&b.0));
self.shortcut_editor_rows = rows;
self.shortcut_pending_add = false;
@@ -271,7 +269,9 @@ impl OpenCADStudio {
pub(super) fn run_shortcut(&mut self, key: &str) -> Task<Message> {
let action = self.shortcut_bindings.get(key).or_else(|| {
let base = key.rsplit('+').next()?;
is_named_key(base).then(|| self.shortcut_bindings.get(base)).flatten()
is_named_key(base)
.then(|| self.shortcut_bindings.get(base))
.flatten()
});
let Some(action) = action.cloned() else {
return Task::none();
@@ -346,8 +346,8 @@ impl OpenCADStudio {
"REDO" => Message::Redo,
other => Message::Command(other.to_string()),
};
};
self.update(message)
self.update(message)
}
}