fix(lint): the hand-judged clippy sites in library code
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -60,7 +60,7 @@ fn main() {
|
||||
if rows.is_empty() {
|
||||
continue;
|
||||
}
|
||||
rows.sort_by(|a, b| a.1.cmp(&b.1));
|
||||
rows.sort_by_key(|r| r.1);
|
||||
let ys: Vec<i32> = rows.iter().map(|r| r.1).collect();
|
||||
let gaps: Vec<i32> = ys.windows(2).map(|w| w[1] - w[0]).collect();
|
||||
if rows.len() == 4
|
||||
|
||||
@@ -33,7 +33,7 @@ fn main() {
|
||||
let Some(b) = ui_layout::parse_build(&by) else {
|
||||
continue;
|
||||
};
|
||||
for (_, &(o, s)) in &b.records {
|
||||
for &(o, s) in b.records.values() {
|
||||
records += 1;
|
||||
if o + 12 > by.len() || o + s > by.len() {
|
||||
continue;
|
||||
|
||||
@@ -18,7 +18,7 @@ fn main() {
|
||||
"", "Movie", "etc", "Voice", "Sound", "BGM", "bgm", "se", "SE",
|
||||
];
|
||||
let mut tried = 0usize;
|
||||
let mut check = |name: String, tried: &mut usize| {
|
||||
let check = |name: String, tried: &mut usize| {
|
||||
*tried += 1;
|
||||
let h = name_hash(&name);
|
||||
if wanted.contains(&h) {
|
||||
|
||||
@@ -180,7 +180,6 @@ mod tests {
|
||||
b.extend_from_slice(&[0u8; 28]);
|
||||
b.extend_from_slice(b"plain.t32");
|
||||
b.extend_from_slice(&[0x0e, 0x10, 0xa4]);
|
||||
let off = b.len();
|
||||
b.extend_from_slice(b"T8aD");
|
||||
b.extend_from_slice(&[0u8; 16]);
|
||||
|
||||
|
||||
@@ -666,13 +666,13 @@ mod tests {
|
||||
);
|
||||
// Rotations must match too (the engine rig is the interesting case).
|
||||
let m = &best.1.m;
|
||||
for r in 0..3 {
|
||||
for (r, row) in m.iter().enumerate() {
|
||||
for c in 0..3 {
|
||||
assert!(
|
||||
(m[r][c] - want.m[r][c]).abs() < 0.02,
|
||||
(row[c] - want.m[r][c]).abs() < 0.02,
|
||||
"{}: static M row{r} {:?} != captured {:?}",
|
||||
want.part,
|
||||
m[r],
|
||||
row,
|
||||
want.m[r]
|
||||
);
|
||||
}
|
||||
|
||||
@@ -220,19 +220,19 @@ impl Element {
|
||||
let timed: Vec<(u32, &Keyframe)> =
|
||||
ks.iter().filter_map(|k| k.time.map(|tt| (tt, k))).collect();
|
||||
if timed.is_empty() {
|
||||
return Some(ks[ks.len() - 1].clone());
|
||||
return Some(ks[ks.len() - 1]);
|
||||
}
|
||||
if t <= timed[0].0 {
|
||||
return Some(timed[0].1.clone());
|
||||
return Some(*timed[0].1);
|
||||
}
|
||||
if t >= timed[timed.len() - 1].0 {
|
||||
return Some(timed[timed.len() - 1].1.clone());
|
||||
return Some(*timed[timed.len() - 1].1);
|
||||
}
|
||||
for w in timed.windows(2) {
|
||||
let ((t0, a), (t1, b)) = (w[0], w[1]);
|
||||
if t >= t0 && t <= t1 {
|
||||
if t1 == t0 {
|
||||
return Some(b.clone());
|
||||
return Some(*b);
|
||||
}
|
||||
let f = (t - t0) as f64 / (t1 - t0) as f64;
|
||||
let li = |x: i32, y: i32| x + ((y - x) as f64 * f).round() as i32;
|
||||
@@ -260,7 +260,7 @@ impl Element {
|
||||
});
|
||||
}
|
||||
}
|
||||
Some(timed[timed.len() - 1].1.clone())
|
||||
Some(*timed[timed.len() - 1].1)
|
||||
}
|
||||
|
||||
pub fn rest(&self) -> Option<&Keyframe> {
|
||||
@@ -1088,7 +1088,7 @@ pub fn forced_backdrop(build: &UiBuild, el: &Element) -> bool {
|
||||
let (dw, dh) = ((el.pivot_x * 2) as u64, (el.pivot_y * 2) as u64);
|
||||
let opaque: Vec<u32> = (0..=tmax)
|
||||
.filter(|&t| {
|
||||
el.pose_at(t).map_or(false, |k| {
|
||||
el.pose_at(t).is_some_and(|k| {
|
||||
k.fade >> 24 == 255
|
||||
&& dw * k.scale_x as u64 / 100 >= build.design_w as u64
|
||||
&& dh * k.scale_y as u64 / 100 >= build.design_h as u64
|
||||
@@ -1428,7 +1428,7 @@ pub fn compose_with_order(
|
||||
None => e.rest().cloned(),
|
||||
};
|
||||
let differs = lb.elements.iter().any(|le| {
|
||||
pose(le).map_or(false, |lk| {
|
||||
pose(le).is_some_and(|lk| {
|
||||
lk.rotation_deg != 0 || lk.scale_x != kf.scale_x || lk.scale_y != kf.scale_y
|
||||
})
|
||||
});
|
||||
@@ -1613,6 +1613,9 @@ fn combine(additive: bool, sc: u32, sa: u32, dc: u32) -> u8 {
|
||||
}
|
||||
}
|
||||
|
||||
// Every argument is a separate axis of one draw call; bundling them into a
|
||||
// struct would only move the list somewhere else.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn blit(
|
||||
canvas: &mut [u8],
|
||||
cw: u32,
|
||||
@@ -1812,7 +1815,7 @@ mod tests {
|
||||
for y in 0..64 {
|
||||
for x in 0..64 {
|
||||
if c[((y * 64 + x) * 4 + 3) as usize] != 0 {
|
||||
v.push((x as i32, y as i32));
|
||||
v.push((x, y));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user