Skip to content

allow-unwrap-in-tests = true has no effect in integration tests #10011

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

Closed
daxpedda opened this issue Dec 1, 2022 · 0 comments · Fixed by #10391
Closed

allow-unwrap-in-tests = true has no effect in integration tests #10011

daxpedda opened this issue Dec 1, 2022 · 0 comments · Fixed by #10391
Labels
I-false-positive Issue: The lint was triggered on code it shouldn't have

Comments

@daxpedda
Copy link
Contributor

daxpedda commented Dec 1, 2022

Description

Using allow-unwrap-in-tests = true in clippy.toml has no effect in integration tests. clippy::unwrap_used will still lint there.

Since #9686 it's easy to workaround it, one can just put #![cfg(test)] at the top of the file.

Is this intended or is this considered a bug? Does Clippy have a way to detect it's seeing an integration test?

Version

rustc 1.67.0-nightly (c97b539e4 2022-11-30)
binary: rustc
commit-hash: c97b539e408ea353f4fde2f9251d598291fec421
commit-date: 2022-11-30
host: x86_64-unknown-linux-gnu
release: 1.67.0-nightly
LLVM version: 15.0.4

Additional Labels

No response

@Alexendoo Alexendoo added the I-false-positive Issue: The lint was triggered on code it shouldn't have label Dec 1, 2022
bors added a commit that referenced this issue Feb 23, 2023
Fix test function checker in `unwrap_used`, `expect_used`

After #9686 , `unwrap` and `expect` in integration tests and raw test functions won't be allowed.

fixes #10011
fixes #10238
fixes #10264

---

changelog: Fix: [`expect_used`], [`unwrap_used`], [`dbg_macro`], [`print_stdout`], [`print_stderr`]: No longer lint in test functions, if the related configuration is set
[#10391](#10391)
<!-- changelog_checked -->
@bors bors closed this as completed in b528cc9 Feb 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

2 participants