From 0bd68b63421d47b69a7f76718dd633ecd2058a4b Mon Sep 17 00:00:00 2001 From: Tassilo Horn Date: Tue, 15 Mar 2022 10:58:27 +0100 Subject: [PATCH] Make clippy happy --- Cargo.lock | 16 ++++++++-------- src/cmds.rs | 17 ++++++++++------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ba406d7..617a142 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -42,9 +42,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "3.1.5" +version = "3.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced1892c55c910c1219e98d6fc8d71f6bddba7905866ce740066d8bfea859312" +checksum = "d8c93436c21e4698bacadf42917db28b23017027a4deccb35dbe47a7e7840123" dependencies = [ "atty", "bitflags", @@ -165,9 +165,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.119" +version = "0.2.120" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bf2e165bb3457c8e098ea76f3e3bc9db55f87aa90d52d0e6be741470916aaa4" +checksum = "ad5c14e80759d0939d013e6ca49930e59fc53dd8e5009132f76240c179380c09" [[package]] name = "log" @@ -292,9 +292,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.5.4" +version = "1.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" +checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286" dependencies = [ "aho-corasick", "memchr", @@ -402,9 +402,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.86" +version = "1.0.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a65b3f4ffa0092e9887669db0eae07941f023991ab58ea44da8fe8e2d511c6b" +checksum = "ebd69e719f31e88618baa1eaa6ee2de5c9a1c004f1e9ecdb58e8352a13f20a01" dependencies = [ "proc-macro2", "quote", diff --git a/src/cmds.rs b/src/cmds.rs index 8d01017..52096f6 100644 --- a/src/cmds.rs +++ b/src/cmds.rs @@ -499,14 +499,17 @@ pub fn switch_to_app_or_urgent_or_lru_window( let wins = tree.get_windows(); let app_win = name.and_then(|n| wins.iter().find(|w| w.node.get_app_name() == n)); - if app_win.is_none() || app_win.unwrap().node.is_current() { - if let Some(win) = wins.get(0) { - focus_window_by_id(win.node.id) - } else { - log::debug!("No window to switch to.") + match app_win { + Some(app_win) if !app_win.node.is_current() => { + focus_window_by_id(app_win.node.id) + } + _ => { + if let Some(win) = wins.get(0) { + focus_window_by_id(win.node.id) + } else { + log::debug!("No window to switch to.") + } } - } else { - focus_window_by_id(app_win.unwrap().node.id) } }