Unactionable clippy error

Hi,

I'm working on a project which stores several large arrays in consts. Running cargo clippy shows errors of this kind:

error: maximum number of nodes exceeded in constant params::ENC_EMB_GRU_GRU_WEIGHT_HH_L0
   --> /path/to/project/target/debug/build/<hash>/out/model_parameters.rs:192:1
    |
192 | pub const ENC_EMB_GRU_GRU_WEIGHT_HH_L0: Tensor<f32> = Tensor::from_slice_const([768, 256], ENC_EMB_GRU_GRU_WEIGHT_HH_L0_DATA);
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The project builds fine, the problem is with clippy. I opened Unactionable error: maximum number of nodes exceeded in constant · Issue #14970 · rust-lang/rust-clippy · GitHub to ask about this but so far I've received no feedback so here I am.

Has anybody run into this too? This is causing issues mostly with CI in my project.

The error seems to originate from

VALTREE_MAX_NODES is 100_000. Assuming your tensor is 768 x 256 that indeed exceeds this limit. The reason it works outside of clippy is likely that nothing is turning the contant into a val tree. If you use a value as const generic, it is turned into a val tree. Some lint inside clippy is likely also turning consts into val trees. Try building with -Ztreat-err-as-bug on nightly to get a backtrace where this happens.

Huh, I had disabled the module causing problems using

#[cfg(not(clippy))]
mod params;

I removed the attribute for testing and this no longer seems to be a problem in 1.88

Thanks for looking into it anyway!