80 findings, not the 14 the first run showed -- clippy stops at the first failing compilation unit, so `--keep-going` is what makes the list complete. 60 were machine-applicable (`cargo clippy --fix`). The rest by hand: * five descending `sort_by` -> `sort_by_key(Reverse(..))` * `chunks_exact(4)` on both sides of four zips, so the compared items stay `[u8; 4]` rather than one array against one slice * three `type` aliases for the census maps and the captured-quad tuple * `&PathBuf` -> `&Path` in two disc tests * two range loops; one of them keeps `#[allow(needless_range_loop)]` with the reason -- the index is into a map's value, which changes each iteration * the module doc list in `invert_capture` re-indented to markdown's rules * `blit`'s eight arguments get `#[allow(too_many_arguments)]`, not a struct One dead `let off = b.len();` in a `ratc` test is dropped rather than renamed. The sibling test at :162 is the one that asserts an offset; if this one was meant to as well, that is a test change and not a lint fix. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
40 lines
1.6 KiB
Rust
40 lines
1.6 KiB
Rust
//! Where does `settle_window()`'s answer come from? The port agent recomputes the
|
|
//! publisher splash's widest keyframe-free gap as 190 units; `--settle` reports 8.
|
|
//! One of the two readings is wrong and the file settles it.
|
|
//! cargo run -p sylpheed-formats --example settle_window_check -- <build>
|
|
use std::path::PathBuf;
|
|
use sylpheed_formats::{pak::PakArchive, ui_layout};
|
|
fn main() {
|
|
let b: usize = std::env::args()
|
|
.nth(1)
|
|
.unwrap_or("10".into())
|
|
.parse()
|
|
.unwrap();
|
|
let root = PathBuf::from(std::env::var("SYLPHEED_DISC").expect("SYLPHEED_DISC"));
|
|
let ar = PakArchive::open(root.join("dat/GP_TITLE.pak")).expect("GP_TITLE");
|
|
let by = ar.read(&ar.entries()[b]).expect("entry");
|
|
let build = ui_layout::parse_build(&by).expect("parse");
|
|
println!("entry {b}: {} elements", build.elements.len());
|
|
for el in &build.elements {
|
|
let ts: Vec<String> = el
|
|
.keyframes
|
|
.iter()
|
|
.map(|k| k.time.map(|v| v.to_string()).unwrap_or("-".into()))
|
|
.collect();
|
|
println!(" {:26} [{}]", el.name, ts.join(" "));
|
|
}
|
|
let mut ts: Vec<u32> = build
|
|
.elements
|
|
.iter()
|
|
.flat_map(|e| e.keyframes.iter().filter_map(|k| k.time))
|
|
.collect();
|
|
ts.sort_unstable();
|
|
ts.dedup();
|
|
println!("\nunion of all element keyframe times: {ts:?}");
|
|
let gaps: Vec<(u32, u32, u32)> = ts.windows(2).map(|w| (w[1] - w[0], w[0], w[1])).collect();
|
|
let mut g = gaps.clone();
|
|
g.sort_by_key(|a| std::cmp::Reverse(a.0));
|
|
println!("widest gaps: {:?}", &g[..g.len().min(4)]);
|
|
println!("settle_window() reports {:?}", build.settle_window());
|
|
}
|