Skip to content

unwrap_used and tests in a "tests" folder #10238

Closed
@cemoktra

Description

@cemoktra

Summary

After updating to Rust 1.67 tests in free standing tests folders fail with the unwrap_used lint despite allow-unwrap-in-tests = true being set.

Workaround is to add #![cfg(test)] to the top of those files

Reproducer

Create a new project, add a tests folder in the root (not under src) and add test to it that uses .unwrap(). Run clippy with clippy::unwrap_used set to deny.

Version

rustc 1.67.0 (fc594f156 2023-01-24)
binary: rustc
commit-hash: fc594f15669680fa70d255faec3ca3fb507c3405
commit-date: 2023-01-24
host: x86_64-unknown-linux-gnu
release: 1.67.0
LLVM version: 15.0.6

Additional Labels

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions