Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.
/ rustfix Public archive

Automatically apply the suggestions made by rustc

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

rust-lang/rustfix

⚠️ Rustfix has moved

The rustfix crate has moved to https://github.com/rust-lang/cargo/tree/master/crates/rustfix. Any issues about the rustfix library or cargo fix should be filed at https://github.com/rust-lang/cargo/issues. Any issues about the suggestions generated by the compiler should be filed at https://github.com/rust-lang/rust/issues.


rustfix

Latest Version Rust Documentation

Rustfix is a library defining useful structures that represent fix suggestions from rustc.

Current status

Currently, rustfix is split into two crates:

  • rustfix, a library for consuming and applying suggestions in the format that rustc outputs (this crate)
  • cargo-fix, a binary that works as cargo subcommand and that end users will use to fix their code (maintained in the cargo repo).

The library (and therefore this repo) is considered largely feature-complete. This is because:

  • There is no compiler or even rust-specific logic here
  • New lints and suggestions come from the Rust compiler (and external lints, like clippy).
  • rustfix doesn't touch the filesystem to implement fixes, or read from disk

Installation

cargo fix is a built-in command in Cargo since Rust 1.29. There is no need to install it separately from crates.io.

To use the rustfix library for use in your own fix project, add it to your Cargo.toml.

Using cargo fix --edition to transition to Rust 2021

Instructions on how to use this tool to transition a crate to Rust 2021 can be found in the Rust Edition Guide.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.