#17526·cargo

Add `cargo unfix` to remove lint acknowledgements

Author: rockbronzemanCreated Sep 28, 2026Updated Sep 28, 2026
LabelsC-feature-requestS-triage

Problem

There is currently no convenient way to remove lint acknowledgements from a project.

During development, it can be useful to suppress warnings temporarily with #[allow(...)] or #[expect(...)], either manually or with cargo fix. Once the code has settled, however, you may want to see those warnings again and reassess them.

At the moment, this requires finding and removing the acknowledgements manually, or disabling acknowledgements.

Proposed Solution

Add a cargo unfix command.

By default, cargo unfix would remove outer #[allow(...)] attributes from the project.

Additional options could extend its scope:

cargo unfix --expect

Also remove #[expect(...)] attributes.

cargo unfix --inner

Also remove inner lint attributes (#![allow(...)], and #![expect(...)] when --expect is used).

cargo unfix --manifest

Also handle lint configuration in Cargo.toml (potentially with comments, see notes).

The options would be composable:

cargo unfix --expect --inner --manifest

Remove #[allow(...)] and #[expect(...)] attributes, including inner lint attributes from the project, and handle lint configuration in Cargo.toml.

Notes

cargo unfix would not attempt to reverse the source changes made by cargo fix. It would specifically remove lint acknowledgements so that the compiler can report those lints again.

For Cargo.toml, lint configuration could be commented out rather than deleted, preserving the previous configuration, as lingering comments would likely be convenient in the future, and cause little headache compared to commented acknowledgements in code:

[lints.rust]
# dead_code = "allow"
# unused_variables = "allow"

A --lint <lint> option could also allow removing acknowledgements for only a particular lint:

cargo unfix --lint dead_code

The intended workflow would be:

cargo fix
# work on the project
cargo unfix
# see the warnings again