Skip to content

Commit 67fde58

Browse files
committed
fix(stark): satisfy unnecessary_lazy_evaluations on the cuda clippy pass
Under the cuda feature the unwrap_or_else closure in table_parallelism collapses to a plain num_airs, tripping the lint on the Makefile's cuda clippy pass. Move the cfg split outside the closure: the cuda arm uses unwrap_or, the CPU arm keeps its lazy host_cores() call.
1 parent 2845892 commit 67fde58

1 file changed

Lines changed: 8 additions & 14 deletions

File tree

crypto/stark/src/prover.rs

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -626,20 +626,14 @@ fn host_cores() -> usize {
626626
pub fn table_parallelism(num_airs: usize) -> usize {
627627
#[cfg(feature = "parallel")]
628628
{
629-
let k = parallelism_override().unwrap_or_else(|| {
630-
// GPU builds: run every table. The work `k` divides is device- and
631-
// workload-bound, not core-bound — see the doc comment.
632-
#[cfg(feature = "cuda")]
633-
{
634-
num_airs
635-
}
636-
// CPU builds: every table is pure host work, so `k` competes for
637-
// the same cores the rayon pool wants.
638-
#[cfg(not(feature = "cuda"))]
639-
{
640-
(host_cores() / 3).max(1)
641-
}
642-
});
629+
// GPU builds: run every table. The work `k` divides is device- and
630+
// workload-bound, not core-bound — see the doc comment.
631+
#[cfg(feature = "cuda")]
632+
let k = parallelism_override().unwrap_or(num_airs);
633+
// CPU builds: every table is pure host work, so `k` competes for
634+
// the same cores the rayon pool wants.
635+
#[cfg(not(feature = "cuda"))]
636+
let k = parallelism_override().unwrap_or_else(|| (host_cores() / 3).max(1));
643637
k.clamp(1, num_airs.max(1))
644638
}
645639
#[cfg(not(feature = "parallel"))]

0 commit comments

Comments
 (0)