Skip to content

Commit 24fa775

Browse files
committed
Fix clippy assertions-on-constants in fade table test
Bind FADE to a local before asserting so the checks run on a runtime value rather than a constant expression.
1 parent 7e3168f commit 24fa775

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

src/slip.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -575,21 +575,19 @@ mod tests {
575575
/// from ~0 to ~1, and symmetric so a slip preserves the signal level across the splice.
576576
#[test]
577577
fn fade_table_is_valid() {
578-
let n = FADE.len();
578+
let fade = FADE;
579+
let n = fade.len();
580+
assert!(fade[0] > 0.0 && fade[0] < 0.02, "should ease in from near 0");
579581
assert!(
580-
FADE[0] > 0.0 && FADE[0] < 0.02,
581-
"should ease in from near 0"
582-
);
583-
assert!(
584-
FADE[n - 1] > 0.98 && FADE[n - 1] < 1.0,
582+
fade[n - 1] > 0.98 && fade[n - 1] < 1.0,
585583
"should ease out to near 1"
586584
);
587-
for pair in FADE.windows(2) {
585+
for pair in fade.windows(2) {
588586
assert!(pair[1] > pair[0], "must be strictly increasing");
589587
}
590588
// Symmetric: w(k) + w(N-1-k) == 1, so blended levels stay constant.
591589
for k in 0..n {
592-
assert!((FADE[k] + FADE[n - 1 - k] - 1.0).abs() < 1e-12);
590+
assert!((fade[k] + fade[n - 1 - k] - 1.0).abs() < 1e-12);
593591
}
594592
}
595593

0 commit comments

Comments
 (0)