Skip to content

Rust pack: seed unwrap_used/expect_used lint levels and document the test-helper exemption #2103

Backlog

Description

@gerchowl

Problem

The pack seeds clippy.toml with "unwrap/expect allowed in tests", and the crate lints unsafe_code = forbid, missing_docs = warn and clippy::all. But the lint levels clippy::unwrap_used / clippy::expect_used aren't in the seeded workspace [lints] table. So clippy.toml's test allowance has nothing to relax, and shipped code can still unwrap() freely.

Also, allow-unwrap-in-tests / allow-expect-in-tests cover only #[test] functions. Helpers in integration-test files, test-only binaries and proptest strategy modules are flagged once the lints are on. Every adopter then writes the same file-level allow.

Found while adopting devkit 1.19.2 in a private workspace (2026-12-01).

Proposal

  • Seed [workspace.lints.clippy] with unwrap_used = "warn" and expect_used = "warn". CI's clippy -D warnings makes them errors.
  • Document the standard exemption for test helpers and dev binaries in the pack: a file-level #![allow(clippy::unwrap_used, clippy::expect_used)] with a one-line reason. Or have the seeded crate template put it into tests/*.rs helpers from the start.
  • Make sure every workspace member gets [lints] workspace = true when it's scaffolded or detected, so the table applies.

Acceptance

  • A new adopter's library code with .unwrap() fails CI.
  • Test helpers following the documented pattern don't fail it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions