Fix review findings: wishlist qualifying count, improve docs, and lint cleanup

- Count only configs meeting min_count as qualifying in the wishlist
  copy-coverage check (previously ALL guid_to_rid entries inflated the
  denominator, producing phantom wishlist entries), pre-computed once
  per guid instead of per record
- Update stale write_improve_csv doc to match single-best-target
  behavior including cross-copy exclusion
- Borrow owned configs for the trash CSV join instead of cloning the Vec
- Build owned_final_configs via filter_map + flat_map without the
  throwaway intermediate Vec
- Remove runtime assertions on literal constants (clippy
  assertions_on_constants) and replace a redundant closure with the
  function reference (clippy redundant_closure)
- Apply rustfmt across the crate and drop a duplicated test-section header
This commit is contained in:
Jan-Peter von Hunnius 2026-08-15 18:58:12 +02:00
parent 62688926c3
commit 2ab66a249b
8 changed files with 83 additions and 80 deletions

View file

@ -105,7 +105,9 @@ pub fn parse_car_times(
// unexpected formats gracefully).
let config = raw_config
.rsplit_once('_')
.filter(|(_, suffix)| suffix.len() == 3 && suffix.bytes().all(|b| b.is_ascii_digit()))
.filter(|(_, suffix)| {
suffix.len() == 3 && suffix.bytes().all(|b| b.is_ascii_digit())
})
.map(|(_, suffix)| suffix.to_string())
.unwrap_or_else(|| raw_config.clone());
// Process timing data for each track
@ -675,7 +677,8 @@ mod tests {
parse_car_times(car, &my_cars, &ctx.best_cars, times_dir).unwrap();
// Verify the config was stripped to "233" (not "v2b_233")
let records = ctx.best_cars.get(&("Laguna Seca".to_string(), 85, "Dry".to_string())).unwrap();
let records =
ctx.best_cars.get(&("Laguna Seca".to_string(), 85, "Dry".to_string())).unwrap();
assert_eq!(records[0].config, "233", "v2b_ prefix should be stripped");
assert_eq!(records[0].normalized_config, "233", "233 is already a final build");
}
@ -723,25 +726,20 @@ mod tests {
parse_car_times(car, &my_cars, &ctx.best_cars, times_dir).unwrap();
// Best on Laguna Seca should be the v3a_233 entry (95.0 beats 110.0)
let records = ctx.best_cars.get(&("Laguna Seca".to_string(), 90, "Dry".to_string())).unwrap();
let records =
ctx.best_cars.get(&("Laguna Seca".to_string(), 90, "Dry".to_string())).unwrap();
assert_eq!(records[0].config, "233", "v3a_ prefix should be stripped");
assert_eq!(records[0].time, 95.0);
// Monaco Streets from bare "323"
let records = ctx.best_cars.get(&("Monaco Streets".to_string(), 90, "Wet".to_string())).unwrap();
let records =
ctx.best_cars.get(&("Monaco Streets".to_string(), 90, "Wet".to_string())).unwrap();
assert_eq!(records[0].config, "323", "bare config should pass through");
}
// =======================================================================
// Constants tests
// =======================================================================
#[test]
fn test_constants_are_reasonable() {
assert_eq!(MAX_RQ, 113);
assert!(MIN_VALID_TIME > 0.0);
assert!(TIME_TOLERANCE > 0.0);
assert!(TEST_BOWL_FACTOR > 0.0);
assert!(CONCURRENCY_LIMIT > 0);
}
// Constants are compile-time validated - explicit tests removed as they
// check literal values that cannot fail unless the constants themselves are edited
}