Auto merge of #12172 - samueltardieu:issue-12166, r=Alexendoo
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. changelog: [`no_effect_underscore_binding`]: warn only if variable is unused Fix #12166
This commit is contained in:
commit
73868563ed
3 changed files with 116 additions and 82 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue