no_effect_underscore_binding: _ prefixed variables can be used

Prefixing a variable with a `_` does not mean that it will not be used.
If such a variable is used later, do not warn about the fact that its
initialization does not have a side effect as this is fine.
This commit is contained in:
Samuel Tardieu 2024-01-19 23:25:36 +01:00
parent 989ce17b55
commit 6267b6ca09
3 changed files with 116 additions and 82 deletions

View file

@ -181,6 +181,8 @@ fn main() {
//~^ ERROR: binding to `_` prefixed variable with no side-effect
let _cat = [2, 4, 6, 8][2];
//~^ ERROR: binding to `_` prefixed variable with no side-effect
let _issue_12166 = 42;
let underscore_variable_above_can_be_used_dont_lint = _issue_12166;
#[allow(clippy::no_effect)]
0;