about summary refs log tree commit diff
path: root/tests/codegen/patchable-function-entry
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-03-09 20:15:02 +0000
committerbors <bors@rust-lang.org>2024-03-09 20:15:02 +0000
commitd8a9068e8369a6ef454581b5f07d2caadfc62109 (patch)
tree55541e2fbd884eb2f7d100883970695ceeb35ecc /tests/codegen/patchable-function-entry
parentc173ea64b7c3ff289098569de04217e34454c59f (diff)
parent0c82fd01c7968e09c233abbf9b7728ccea230f49 (diff)
downloadrust-d8a9068e8369a6ef454581b5f07d2caadfc62109.tar.gz
rust-d8a9068e8369a6ef454581b5f07d2caadfc62109.zip
Auto merge of #12449 - Jacherr:issue-6439, r=llogiq
Add new lint `zero_repeat_side_effects`

Fixes https://github.com/rust-lang/rust-clippy/issues/6439

Adds a new `suspicious` lint zero_repeat_side_effects. This lint warns the user when initializing an array or `Vec` using the `Repeat` syntax, i.e., `[x; y]`. If `x` is an `Expr::Call/MethodCall` or contains an `Expr::Call/MethodCall` and `y` is zero, then there is a chance that the internal call can produce side effects, such as printing to console, which is not very obvious.

This lint warns against this and instead suggests to separate out the function call and the array/Vec initialization.

changelog: Add new lint `zero_repeat_side_effects`
Diffstat (limited to 'tests/codegen/patchable-function-entry')
0 files changed, 0 insertions, 0 deletions