diff --git a/komorebi-bar/src/widgets/systray.rs b/komorebi-bar/src/widgets/systray.rs index f3f8d878..5d6f6367 100644 --- a/komorebi-bar/src/widgets/systray.rs +++ b/komorebi-bar/src/widgets/systray.rs @@ -723,7 +723,7 @@ impl Systray { .filter(|icon| icon.is_visible) .cloned() .collect(); - icons.sort_by(|a, b| a.stable_id.to_string().cmp(&b.stable_id.to_string())); + icons.sort_by_key(|a| a.stable_id.to_string()); icons } @@ -731,7 +731,7 @@ impl Systray { fn get_all_icons() -> Vec { let state = SYSTRAY_STATE.lock(); let mut icons: Vec<_> = state.icons.values().cloned().collect(); - icons.sort_by(|a, b| a.stable_id.to_string().cmp(&b.stable_id.to_string())); + icons.sort_by_key(|a| a.stable_id.to_string()); icons } diff --git a/komorebi/src/monitor.rs b/komorebi/src/monitor.rs index 2f2bfb64..48c357b9 100644 --- a/komorebi/src/monitor.rs +++ b/komorebi/src/monitor.rs @@ -307,12 +307,10 @@ impl Monitor { DefaultLayout::RightMainVerticalStack => { workspace.add_container_to_front(container); } - DefaultLayout::UltrawideVerticalStack => { - if workspace.containers().len() == 1 { - workspace.insert_container_at_idx(0, container); - } else { - workspace.add_container_to_back(container); - } + DefaultLayout::UltrawideVerticalStack + if workspace.containers().len() == 1 => + { + workspace.insert_container_at_idx(0, container); } _ => { workspace.add_container_to_back(container); @@ -332,12 +330,10 @@ impl Monitor { match layout { DefaultLayout::RightMainVerticalStack - | DefaultLayout::UltrawideVerticalStack => { - if workspace.containers().len() == 1 { - workspace.add_container_to_back(container); - } else { - workspace.insert_container_at_idx(target_index, container); - } + | DefaultLayout::UltrawideVerticalStack + if workspace.containers().len() == 1 => + { + workspace.add_container_to_back(container); } _ => { workspace.insert_container_at_idx(target_index, container); diff --git a/komorebi/src/process_movement.rs b/komorebi/src/process_movement.rs index 5f4d896a..675788a0 100644 --- a/komorebi/src/process_movement.rs +++ b/komorebi/src/process_movement.rs @@ -28,12 +28,10 @@ pub fn listen_for_movements(wm: Arc>) { Action::Press => ignore_movement = true, Action::Release => ignore_movement = false, }, - Event::MouseMoveRelative { .. } => { - if !ignore_movement { - match wm.lock().raise_window_at_cursor_pos() { - Ok(()) => {} - Err(error) => tracing::error!("{}", error), - } + Event::MouseMoveRelative { .. } if !ignore_movement => { + match wm.lock().raise_window_at_cursor_pos() { + Ok(()) => {} + Err(error) => tracing::error!("{}", error), } } _ => {} diff --git a/komorebi/src/window_manager.rs b/komorebi/src/window_manager.rs index 080a4d8d..ecfbce24 100644 --- a/komorebi/src/window_manager.rs +++ b/komorebi/src/window_manager.rs @@ -3376,7 +3376,7 @@ impl WindowManager { let rules: &mut Vec<(usize, Layout)> = &mut workspace.layout_rules; rules.retain(|pair| pair.0 != at_container_count); rules.push((at_container_count, Layout::Default(layout))); - rules.sort_by(|a, b| a.0.cmp(&b.0)); + rules.sort_by_key(|a| a.0); // If this is the focused workspace on a non-focused screen, let's update it if focused_monitor_idx != monitor_idx && focused_workspace_idx == workspace_idx { @@ -3419,7 +3419,7 @@ impl WindowManager { let rules: &mut Vec<(usize, Layout)> = &mut workspace.layout_rules; rules.retain(|pair| pair.0 != at_container_count); rules.push((at_container_count, Layout::Custom(layout))); - rules.sort_by(|a, b| a.0.cmp(&b.0)); + rules.sort_by_key(|a| a.0); // If this is the focused workspace on a non-focused screen, let's update it if focused_monitor_idx != monitor_idx && focused_workspace_idx == workspace_idx { diff --git a/komorebic/src/main.rs b/komorebic/src/main.rs index 40c2c009..00fa2318 100644 --- a/komorebic/src/main.rs +++ b/komorebic/src/main.rs @@ -1924,13 +1924,11 @@ fn main() -> eyre::Result<()> { "Application specific configuration file path has not been set. Try running 'komorebic fetch-asc'\n" ); } - Some(AppSpecificConfigurationPath::Single(path)) => { - if !path.exists() { - println!( - "Application specific configuration file path '{}' does not exist. Try running 'komorebic fetch-asc'\n", - path.display() - ); - } + Some(AppSpecificConfigurationPath::Single(path)) if !path.exists() => { + println!( + "Application specific configuration file path '{}' does not exist. Try running 'komorebic fetch-asc'\n", + path.display() + ); } _ => {} }