chore(workspace): satisfy clippy --all-targets in test code

Five test-only lints surfaced by --all-targets were blocking CI under
-D warnings: a useless vec! in a leaderboard sort test, a
field_reassign_with_default in tuning tests, and three
assertions_on_constants in card_plugin sanity tests. The constant
assertions are now wrapped in const blocks so they run at compile time;
the runtime-formatted values were dropped from their messages because
const-block assert messages must be string literals.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
funman300
2026-04-30 19:54:40 +00:00
parent 534870a68a
commit 9bfca929cb
3 changed files with 20 additions and 15 deletions
@@ -210,8 +210,10 @@ mod tests {
#[test] #[test]
fn scale_duration_applies_multiplier() { fn scale_duration_applies_multiplier() {
let mut t = AnimationTuning::default(); let t = AnimationTuning {
t.duration_scale = 0.5; duration_scale: 0.5,
..AnimationTuning::default()
};
assert!((t.scale_duration(1.0) - 0.5).abs() < 1e-6); assert!((t.scale_duration(1.0) - 0.5).abs() < 1e-6);
assert!((t.scale_duration(0.25) - 0.125).abs() < 1e-6); assert!((t.scale_duration(0.25) - 0.125).abs() < 1e-6);
} }
+9 -6
View File
@@ -1510,27 +1510,30 @@ mod tests {
#[test] #[test]
fn tableau_fan_frac_is_in_unit_interval() { fn tableau_fan_frac_is_in_unit_interval() {
const {
assert!( assert!(
TABLEAU_FAN_FRAC > 0.0 && TABLEAU_FAN_FRAC < 1.0, TABLEAU_FAN_FRAC > 0.0 && TABLEAU_FAN_FRAC < 1.0,
"TABLEAU_FAN_FRAC must be in (0, 1), got {TABLEAU_FAN_FRAC}" "TABLEAU_FAN_FRAC must be in (0, 1)"
); );
} }
}
#[test] #[test]
fn flip_half_secs_is_positive() { fn flip_half_secs_is_positive() {
assert!( const {
FLIP_HALF_SECS > 0.0, assert!(FLIP_HALF_SECS > 0.0, "FLIP_HALF_SECS must be positive");
"FLIP_HALF_SECS must be positive, got {FLIP_HALF_SECS}" }
);
} }
#[test] #[test]
fn font_size_frac_is_positive_and_reasonable() { fn font_size_frac_is_positive_and_reasonable() {
const {
assert!( assert!(
FONT_SIZE_FRAC > 0.0 && FONT_SIZE_FRAC <= 1.0, FONT_SIZE_FRAC > 0.0 && FONT_SIZE_FRAC <= 1.0,
"FONT_SIZE_FRAC should be in (0, 1], got {FONT_SIZE_FRAC}" "FONT_SIZE_FRAC should be in (0, 1]"
); );
} }
}
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// face_colour (pure) — color-blind mode // face_colour (pure) — color-blind mode
+1 -1
View File
@@ -194,7 +194,7 @@ mod tests {
#[test] #[test]
fn leaderboard_entries_sorted_by_score_descending() { fn leaderboard_entries_sorted_by_score_descending() {
let mut entries = vec![ let mut entries = [
entry("Charlie", Some(1_200)), entry("Charlie", Some(1_200)),
entry("Alice", Some(8_000)), entry("Alice", Some(8_000)),
entry("Bob", Some(3_500)), entry("Bob", Some(3_500)),