Remove two dead counters; clippy clean again
Follow-up to the note in 6d26da3 that two unused-variable warnings in the
sound_bank and overlay tests were pre-existing and deliberately left alone.
They are genuinely dead: `records_seen` was declared and never incremented or
read in either test. The live counters there are `levels`, `records`, `bodies`,
`classes` and `ops` -- each already asserted. Removed.
Worth recording how it went, because it is the same shape as most of the failures
this session. A blind string replace found three occurrences instead of two and
removed a `records_seen` that *was* live, in vtbl_class_ids_are_global. The
first repair put the declaration back inside the per-level loop, which is still
the wrong scope. Only reading the compiler's two errors in order located the
function-level declarations.
Three edits to remove two dead lines, and the tempting one was the last: widen
the replace, or drop the variable and let the warnings back. Deleting the live
counter would have silently changed that test from counting records to comparing
against nothing -- and `ids.len() * 3 < records_seen` would still have compiled
if the declaration had been added anywhere plausible.
The check that caught it was not a test. No test failed on the bad edit, because
the variable was only read in an assertion that stayed true either way for the
levels it ran over. Clippy caught the compile error; nothing else would have.
282 passing with the disc present (23 + 19 + 62 + 156 + 22; disc binary 34.87s),
clippy clean.
This commit is contained in:
@@ -4088,7 +4088,6 @@ fn sound_bank_sblk_head_is_constant_apart_from_one_word() {
|
||||
let mut values: Vec<u32> = Vec::new();
|
||||
let mut bodies: Vec<usize> = Vec::new();
|
||||
let mut levels = 0usize;
|
||||
let mut records_seen = 0usize;
|
||||
for lv in 0..27usize {
|
||||
let Ok(bytes) = std::fs::read(data.join(format!("level{lv}/sound_bank.bin"))) else {
|
||||
continue;
|
||||
@@ -5792,7 +5791,6 @@ fn moby_class_ids_come_from_lvl_vtbl_not_from_the_class_count() {
|
||||
let mut classes: BTreeSet<u32> = BTreeSet::new();
|
||||
let mut records = 0usize;
|
||||
let mut levels = 0usize;
|
||||
let mut records_seen = 0usize;
|
||||
for lv in 0..27usize {
|
||||
let Ok(ov) = std::fs::read(data.join(format!("level{lv}/overlay.bin"))) else {
|
||||
continue;
|
||||
@@ -5892,12 +5890,12 @@ fn vtbl_class_ids_are_global_and_do_not_index_the_class_table() {
|
||||
use std::collections::BTreeSet;
|
||||
|
||||
let mut ids: BTreeSet<u32> = BTreeSet::new();
|
||||
let mut records_seen = 0usize;
|
||||
let mut first_level_new = 0usize;
|
||||
let mut per_level_new = Vec::new();
|
||||
let mut max_count = 0u32;
|
||||
let mut min_count = u32::MAX;
|
||||
let mut levels = 0usize;
|
||||
let mut records_seen = 0usize;
|
||||
for lv in 0..27usize {
|
||||
let (Ok(idx), Ok(ov)) = (
|
||||
std::fs::read(data.join(format!("level{lv}/core_index.bin"))),
|
||||
|
||||
Reference in New Issue
Block a user