Clippy allow vs. assert

           if let Some(blended_zone) = zone_entry.blended {
                #[allow(clippy::assertions_on_constants)]   // Clippy does not like this, but Clippy is wrong.
                assert!(ENABLE_ELEV_BLENDING);  // had better be on if control takes this path
                ...
                splits.blended_layer_coords[blended_zone].index_data.extend_from_slice(&tri[..]); 
            }

Here's a cute little case. Clippy complains about the assert when ENABLE_ELEV_BLENDING evaluates to True at compile time. The assert is there to indicate that this code path should never be taken unless that configuration parameter is on. So it's a legit check.

However, Clippy rejects the "allow" because assert! is a macro.

How to express this in Rust?

Maybe related to this issue?

Oh, nice. It's been fixed, but not in stable Rust yet.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.