2016-07-07 14:49:55 +00:00
|
|
|
# rustfix
|
|
|
|
|
2018-05-05 16:14:11 +00:00
|
|
|
The goal of this tool is to read and apply the suggestions made by rustc.
|
2016-07-07 14:49:55 +00:00
|
|
|
|
2018-05-05 16:14:11 +00:00
|
|
|
## Current status
|
2016-07-07 14:49:55 +00:00
|
|
|
|
2018-05-15 18:44:32 +00:00
|
|
|
Currently, rustfix is split into two crates:
|
2016-07-07 14:49:55 +00:00
|
|
|
|
2018-05-05 16:14:11 +00:00
|
|
|
- `rustfix`, a library for consuming and applying suggestions in the format that `rustc` outputs
|
|
|
|
- and `cargo-fix`, a binary that works as cargo subcommand and that end users will use to fix their code.
|
2016-07-07 14:49:55 +00:00
|
|
|
|
2020-12-13 22:12:54 +00:00
|
|
|
The magic of rustfix is entirely dependent on the diagnostics implemented in the Rust compiler (and external lints, like [clippy]).
|
2016-07-07 14:49:55 +00:00
|
|
|
|
2018-05-05 16:14:11 +00:00
|
|
|
[clippy]: https://github.com/rust-lang-nursery/rust-clippy
|
2016-07-07 14:49:55 +00:00
|
|
|
|
2018-05-13 15:46:46 +00:00
|
|
|
## Installation
|
|
|
|
|
2018-06-22 13:40:38 +00:00
|
|
|
To use the rustfix library, add it to your `Cargo.toml`.
|
2018-05-13 15:46:46 +00:00
|
|
|
|
|
|
|
To get the tool to automatically fix warnings in, run `cargo install cargo-fix`. This will give you `cargo fix`.
|
|
|
|
|
2018-07-20 14:09:44 +00:00
|
|
|
## Using `cargo fix` to transition to Rust 2018
|
|
|
|
|
|
|
|
Instructions on how to use this tool to transition a crate to Rust 2018 can be
|
2018-10-07 07:43:23 +00:00
|
|
|
found [in the Rust Edition Guide.](https://rust-lang-nursery.github.io/edition-guide/editions/transitioning-an-existing-project-to-a-new-edition.html)
|
2018-07-20 14:09:44 +00:00
|
|
|
|
2016-07-07 14:49:55 +00:00
|
|
|
## License
|
|
|
|
|
|
|
|
Licensed under either of
|
|
|
|
|
2016-07-09 13:28:02 +00:00
|
|
|
- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or <http://www.apache.org/licenses/LICENSE-2.0>)
|
|
|
|
- MIT license ([LICENSE-MIT](LICENSE-MIT) or <http://opensource.org/licenses/MIT>)
|
2016-07-07 14:49:55 +00:00
|
|
|
|
|
|
|
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.
|