Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blacklisted_name lint should not run inside the test code #7305

Closed
popzxc opened this issue Jun 1, 2021 · 1 comment · Fixed by #7379
Closed

blacklisted_name lint should not run inside the test code #7305

popzxc opened this issue Jun 1, 2021 · 1 comment · Fixed by #7379
Labels
C-bug Category: Clippy is not doing the correct thing good-first-issue These issues are a good way to get started with Clippy I-false-positive Issue: The lint was triggered on code it shouldn't have

Comments

@popzxc
Copy link
Contributor

popzxc commented Jun 1, 2021

Lint name: blacklisted_name

I tried this code:

#[test]
fn test() {
   let foo_encoded = encode_object("foo"); // Actual functions are not important.
   let foo = parse_object(foo_encoded);
   assert_eq!(foo, "foo");
}

I expected to see this happen: blacklisted_name lint is not emitted. Foo is an OK name for tests, displaying something that is not really important as an object itself and telling programmers to focus on other things.

Instead, this happened: blacklisted_name lint is emitted.

Meta

  • cargo clippy -V: clippy 0.1.52 (9bc8c42b 2021-05-09)

  • rustc -Vv:

    rustc 1.52.1 (9bc8c42bb 2021-05-09)
    binary: rustc
    commit-hash: 9bc8c42bb2f19e745a63f3445f1ac248fb015e53
    commit-date: 2021-05-09
    host: aarch64-apple-darwin
    release: 1.52.1
    LLVM version: 12.0.0
    
@popzxc popzxc added C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have labels Jun 1, 2021
@Diggsey
Copy link

Diggsey commented Jun 6, 2021

Yeah this is going to create false positives in almost all crates with tests :|

@giraffate giraffate added the good-first-issue These issues are a good way to get started with Clippy label Jun 7, 2021
@bors bors closed this as completed in 8d427b6 Jun 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing good-first-issue These issues are a good way to get started with Clippy I-false-positive Issue: The lint was triggered on code it shouldn't have
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants