Closed
Description
Description
The new clippy::arithmetic
lint always lints against usage of arithmetic operators. Would it be feasible to not lint in const contexts? The reasoning for the lint is the overflow/panic behavior, there are a lot of scenarios which could be statically checked.
For instance:
// This will never panic
let x = 60i32 * 100;
// This will never panic and a panic in a const would appear at compile time
const Y = 100u8 + 17;
Would it be feasible to disallow arithmetic only in scenarios which may actually overflow/panic?
Version
binary: rustc
commit-hash: d394408fb38c4de61f765a3ed5189d2731a1da91
commit-date: 2022-08-07
host: x86_64-unknown-linux-gnu
release: 1.65.0-nightly
LLVM version: 14.0.6
Additional Labels
@rustbot label +C-enhancement