Skip to content

Lints should be initialized via derived Default wherever possible #60181

Closed
@stepnivlk

Description

@stepnivlk

As mentioned in this PR #60152 all the lints implementing new to just return Self with empty/default values should use #[derive(Default)] instead to achieve semantic compression.

Example of such a lint
https://github.com/rust-lang/rust/blob/master/src/librustc_lint/builtin.rs#L553
Lint is then instantiated here
https://github.com/rust-lang/rust/blob/master/src/librustc_lint/lib.rs#L135

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-cleanupCategory: PRs that clean code up or issues documenting cleanup.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions