Skip to content

ref_patterns is triggered on generated code #17198

@nazar-pc

Description

@nazar-pc

Summary

ref is sometimes used by proc macros, notably by https://crates.io/crates/parity-scale-codec-derive.

Considering the main stated concern of the lint being clarity of the code, it simply doesn't apply to generated code annotated with #[automatically_derived] attribute.

Lint Name

ref_patterns

Reproducer

No response

Version

rustc 1.97.0-nightly (20de910db 2026-05-02)
binary: rustc
commit-hash: 20de910db49d3476ccf49ea79a4b22e2b5dface0
commit-date: 2026-05-02
host: x86_64-unknown-linux-gnu
release: 1.97.0-nightly
LLVM version: 22.1.4

Additional Labels

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't have

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions