Do not spawn blacklisted_name lint in test context

Fix detecting of the 'test' attribute

Update UI test to actually check that warning is not triggered in the test code

Fix approach for detecting the test module

Add nested test case

Remove code duplication by extracting 'is_test_module_or_function' into 'clippy_utils'

Cleanup the code
This commit is contained in:
Igor Aleksanov 2021-06-19 21:14:05 +03:00
parent 7869e62557
commit 28d3873ef5
4 changed files with 56 additions and 11 deletions

View file

@ -43,3 +43,15 @@ fn issue_1647_ref_mut() {
let ref mut baz = 0;
if let Some(ref mut quux) = Some(42) {}
}
mod tests {
fn issue_7305() {
// `blackisted_name` lint should not be triggered inside of the test code.
let foo = 0;
// Check that even in nested functions warning is still not triggere.
fn nested() {
let foo = 0;
}
}
}