From 9ca30fb29e275bb33a7765ab185056c9a61e0985 Mon Sep 17 00:00:00 2001 From: Brent Westbrook Date: Sun, 19 Jan 2025 18:02:06 -0500 Subject: [PATCH] fix new operator precedence lint --- src/core.rs | 10 +++++----- src/key_handlers.rs | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/core.rs b/src/core.rs index 3c4b3f8..28558c8 100644 --- a/src/core.rs +++ b/src/core.rs @@ -1468,7 +1468,7 @@ pub fn drawbar(state: &mut State, m: *mut Monitor) { let w = textw(&mut state.drw, &text, state.lrpad); drw::setscheme( &mut state.drw, - state.scheme[if ((*m).tagset[(*m).seltags as usize] & 1 << i) + state.scheme[if ((*m).tagset[(*m).seltags as usize] & (1 << i)) != 0 { Scheme::Sel @@ -1486,10 +1486,10 @@ pub fn drawbar(state: &mut State, m: *mut Monitor) { state.bh as u32, state.lrpad as u32 / 2, &text, - (urg as i32) & 1 << i, + (urg as i32) & (1 << i), ); - if (occ & 1 << i) != 0 { + if (occ & (1 << i)) != 0 { drw::rect( &mut state.drw, x + boxs as i32, @@ -1498,9 +1498,9 @@ pub fn drawbar(state: &mut State, m: *mut Monitor) { boxw, (m == state.selmon && !(*state.selmon).sel.is_null() - && ((*(*state.selmon).sel).tags & 1 << i) != 0) + && ((*(*state.selmon).sel).tags & (1 << i)) != 0) as c_int, - (urg & 1 << i) != 0, + (urg & (1 << i)) != 0, ); } x += w as i32; diff --git a/src/key_handlers.rs b/src/key_handlers.rs index 59e339b..f93494d 100644 --- a/src/key_handlers.rs +++ b/src/key_handlers.rs @@ -183,7 +183,7 @@ pub(crate) fn view(state: &mut State, arg: *const Arg) { pertag.curtag = 0; } else { let mut i; - cfor!((i = 0; ((*arg).ui() & 1 << i) == 0; i += 1) {}); + cfor!((i = 0; ((*arg).ui() & (1 << i)) == 0; i += 1) {}); pertag.curtag = i + 1; } } else { @@ -442,10 +442,10 @@ pub(crate) fn toggleview(state: &mut State, arg: *const Arg) { } // test if the user did not select the same tag - if (newtagset & 1 << ((*state.selmon).pertag.curtag - 1)) == 0 { + if (newtagset & (1 << ((*state.selmon).pertag.curtag - 1))) == 0 { (*state.selmon).pertag.prevtag = (*state.selmon).pertag.curtag; let mut i; - cfor!((i = 0; (newtagset & 1 << i) == 0; i += 1) {}); + cfor!((i = 0; (newtagset & (1 << i)) == 0; i += 1) {}); (*state.selmon).pertag.curtag = i + 1; }