Fix clippy after upstream merge (art style test, Fenwick step, pencil bool)

Co-authored-by: nrq6993-a11y <nrq6993-a11y@users.noreply.github.com>
This commit is contained in:
nrq6993-a11y
2026-10-26 18:46:53 +07:00
committed by bflatastic
parent 37995765a1
commit a0b038e9e2
2 changed files with 9 additions and 6 deletions
+1 -2
View File
@@ -827,8 +827,7 @@ mod tests {
#[test]
fn hostile_stroke_paint_flags_ignore_short_operands() {
let mut f = Filter::default();
f.paints = (true, true);
let mut f = Filter { paints: (true, true), ..Filter::default() };
paint_op(&mut f, "Xd", &[V::Num(1.0)]);
assert_eq!(f.paints, (true, true));
paint_op(&mut f, "Xd", &[V::Num(0.0), V::Num(1.0)]);
+8 -4
View File
@@ -15,14 +15,18 @@ pub const MAX_SEGMENT_PAIRS: usize = 1 << 22;
/// Fenwick tree of counts over its slots.
struct Counts(Vec<isize>);
// `isolate_lowest_one` is still unstable in Rust 1.96, and the workspace builds on 1.95 (rust-version).
#[allow(clippy::manual_isolate_lowest_one)]
#[inline]
fn fenwick_step(i: usize) -> usize {
// Same as `i.isolate_lowest_one()`; that API is still unstable on the workspace MSRV.
1 << i.trailing_zeros()
}
impl Counts {
fn add(&mut self, slot: usize, d: isize) {
let mut i = slot + 1;
while let Some(c) = self.0.get_mut(i) {
*c += d;
i += i & i.wrapping_neg();
i += fenwick_step(i);
}
}
@@ -31,7 +35,7 @@ impl Counts {
let (mut i, mut s) = (end.min(self.0.len().saturating_sub(1)), 0);
while i > 0 {
s += self.0.get(i).copied().unwrap_or(0);
i -= i & i.wrapping_neg();
i -= fenwick_step(i);
}
s
}