Skip to content

Commit

Permalink
chore(linter): fix linter (#1666)
Browse files Browse the repository at this point in the history
Co-authored-by: Darius Clark <dariusc93@users.noreply.github.com>
  • Loading branch information
stavares843 and dariusc93 authored Jan 2, 2024
1 parent 7b19a03 commit 2653d64
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions common/src/state/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl Shortcut {
let mut modifier_strs: Vec<String> = self
.modifiers
.iter()
.map(|modifier| modifier_state_to_string(modifier.clone()))
.map(|modifier| modifier_state_to_string(*modifier))
.collect();

modifier_strs.extend(key_code_strs);
Expand All @@ -91,7 +91,7 @@ impl Shortcut {
}

for key_string in keys_and_modifiers {
if key_code_vec.len() > 0 {
if !key_code_vec.is_empty() {
break;
}
match key_string.as_str() {
Expand Down
12 changes: 7 additions & 5 deletions ui/src/components/settings/sub_pages/keybinds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ pub fn KeybindSection(cx: Scope<KeybindSectionProps>) -> Element {
state.write().settings.keybinds.push((
cx.props.shortcut.clone(),
Shortcut {
keys: keys,
modifiers: modifiers,
system_shortcut: system_shortcut,
keys,
modifiers,
system_shortcut,
},
));
*update_keybind.write_silent() = None;
Expand All @@ -116,7 +116,7 @@ pub fn KeybindSection(cx: Scope<KeybindSectionProps>) -> Element {
.map(|(_, sc)| sc.clone())
.unwrap_or_default();

let recorded_bindings = use_state(cx, || vec![]);
let recorded_bindings = use_state(cx, Vec::new);

let eval = use_eval(cx);
let script = AVOID_INPUT_ON_DIV.replace("$UUID", keybind_section_id.as_str());
Expand Down Expand Up @@ -293,7 +293,7 @@ pub fn KeybindSettings(cx: Scope) -> Element {

fn return_string_from_modifier(modifiers: Modifiers) -> Vec<String> {
let mut modifier_string = vec![];
for modifier in modifiers.clone() {
for modifier in modifiers {
match modifier {
Modifiers::ALT => modifier_string.push("Alt".to_string()),
Modifiers::CONTROL => modifier_string.push("Ctrl".to_string()),
Expand All @@ -311,6 +311,8 @@ fn return_string_from_modifier(modifiers: Modifiers) -> Vec<String> {
modifier_string
}

// Suppress the match_like_matches_macro warning for this specific block
#[allow(clippy::match_like_matches_macro)]
fn is_it_a_key_code(key: Key) -> bool {
match key {
Key::Alt => false,
Expand Down
2 changes: 1 addition & 1 deletion ui/src/utils/keyboard/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ fn RenderGlobalShortCuts<'a>(cx: Scope<'a, GlobalShortcutProps>) -> Element<'a>
.props
.modifiers
.iter()
.map(|modifier| modifier_state_to_string(modifier.clone()))
.map(|modifier| modifier_state_to_string(*modifier))
.collect();

let modifiers_and_keys = [modifier_strs.join(" + "), key_code_strs.join(" + ")].join(" + ");
Expand Down

0 comments on commit 2653d64

Please sign in to comment.