Skip to content

Warn the clippy::allow_attributes and clippy::allow_attributes_without_reason lints #17111

@LikeLakers2

Description

@LikeLakers2

This is a tracking issue for warning on the clippy::allow_attributes and clippy::allow_attributes_without_reason lints across all bevy crates.

What are these?

clippy::allow_attributes

This lints against any instances of #[allow(...)], suggesting they be changed to #[expect(...)].

The use case for this is to avoid letting #[allow(...)]s pile up within Bevy's database, especially since #[expect(...)] is now available. By using #![warn(clippy::allow_attributes)], we can remove any unnecessary instances of #[allow(...)].

Do note that it's not possible to forbid this lint - there are instances where we are forced to #[allow(...)], as the lints may not always be triggered (such as in macros for tuples).

Notably, this does not lint against #![allow(...)] (notice the !), per the lint's description:

This lint only warns outer attributes (#[allow]), as inner attributes (#![allow]) are usually used to enable or disable lints on a global scale.

However, I will make an attempt to look for instances of #![allow(...)] anyways... if I remember.

See also:
https://rust-lang.github.io/rust-clippy/master/index.html#allow_attributes

clippy::allow_attributes_without_reason

This lints against any instances of #[allow(...)] or #[expect(...)] that do not include a reason = "..." field.

This ensures that if an expect or allow is used, it is given a reason - which helps to document why it's there in the first place.

Notably, this does not lint against #[warn(...)] or #[deny(...)].

See also:
https://rust-lang.github.io/rust-clippy/master/index.html#allow_attributes_without_reason

Checklist

PRs marked as drafts in the list below mean that something (i.e. another PR) blocking them. Once the blocking PRs are merged, each applicable PR will be updated to fix any conflicts, and marked as ready to merge.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-Cross-CuttingImpacts the entire engineC-Code-QualityA section of code that is hard to understand or changeC-Tracking-IssueAn issue that collects information about a broad development initiativeD-StraightforwardSimple bug fixes and API improvements, docs, test and examplesS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions