Lint name: repeat_once
I tried this code:
fn main() {
const REPEAT_COUNT: usize = 1;
"x".repeat(REPEAT_COUNT);
}
I expected to see this happen: the lint is not triggered because if I used a constant as a parameter I probably intend to allow changing the constant value to something else in the future.
Instead, this happened: the lint triggers
Meta
cargo clippy -V: clippy 0.1.54 (1c6868a 2021-05-27
rustc -Vv:
rustc 1.54.0-nightly (1c6868aa2 2021-05-27)
binary: rustc
commit-hash: 1c6868aa21981b37cbd3fc95828ee3b0ac22d494
commit-date: 2021-05-27
host: x86_64-unknown-linux-gnu
release: 1.54.0-nightly
LLVM version: 12.0.1
Lint name:
repeat_onceI tried this code:
I expected to see this happen: the lint is not triggered because if I used a constant as a parameter I probably intend to allow changing the constant value to something else in the future.
Instead, this happened: the lint triggers
Meta
cargo clippy -V: clippy 0.1.54 (1c6868a 2021-05-27rustc -Vv: