rustfix
rustfix copied to clipboard
Automatically apply the suggestions made by rustc
Right now, there are two main interfaces for running fixes: 1. `cargo fix [--tests|--benches|--lib] 2. `cargo clippy --fix` It's weird that they are so different - I would expect this...
Sometimes a specific lint is the bulk of the suggestions. It would be cool if rustfix supported filtering by lint, enabling `cargo clippy --fix=absurd-extreme-comparisons` or whatever.
Here is a diff created by running `cargo fix --edition-idioms` on a piece of code: ``` diff diff --git a/src/main.rs b/src/main.rs index 900f3d2..3c06c49 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,10...
I have a PR to add a new suggestion to rustc: https://github.com/rust-lang/rust/pull/88672. It uses [`Diagnostic::multipart_suggestions`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_errors/diagnostic/struct.Diagnostic.html#method.multipart_suggestions) since there are multiple ways for the user to change their code. These multiple suggestions...
When the compiler or clippy produce suggestions, some of them are marked as MaybeIncorrect; i.e. the suggestion should probably not be _automatically_ applied. rustfix currently doesn't touch these. This leads...
The following example: ```rust macro_rules! foo { () => { &1; }; } fn main() { foo!(); foo!(); } ``` generates a suggestion (on beta 1.55) to insert a fix...
Some suggestions include overlapping regions. These cause rustfix to fail with an error like: `Could not replace range 22...47 in file -- maybe parts of it were already replaced?` An...
I suggest using [`SmallVec`](https://docs.rs/smallvec/1.6.1/smallvec/struct.SmallVec.html) [(`smallvec` crate)](https://github.com/servo/rust-smallvec) instead of a regular Vec to improve performance, by having a SmallVec allocate primarily on the stack and the heap is secondary. ## Where...
Since https://github.com/rust-lang/rust/pull/77856, rustdoc has a machine applicable suggestion to use `` instead of `url`, to make it a hyperlink in the docs. But there is no way to actually apply...
(Excuse me if this is not the right place to bring this up.) What if a library could use `#[deprecated]` + a convention about what to put in the note...