rust-lang/rustfix

Does not seem to fix cases where generic parameters are missing

Qix- opened this issue · 2 comments

Qix- commented

I'm refactoring an existing library and needing to introduce generic parameters to just about every type in the library.

There are hundreds of the following error message:

error[E0107]: missing generics for enum `Value`
  --> src/utils.rs:26:16
   |
26 |     args: &'a [Value],
   |                ^^^^^ expected 1 generic argument
   |
note: enum defined here, with 1 generic parameter: `State`
  --> src/model/value.rs:19:10
   |
19 | pub enum Value<State> {
   |          ^^^^^ -----
help: add missing generic argument
   |
26 |     args: &'a [Value<State>],
   |                ~~~~~~~~~~~~

However cargo fix doesn't seem to do anything about them when run with cargo fix --allow-dirty --broken-code. Am I missing something, or is this just not something cargo-fix does? Was hoping to automate a lot of this!

ehuss commented

I believe that particular error has an applicability called "HasPlaceholders" which means it cannot be automatically applied since the suggestion may not be correct. rust-lang/cargo#13023 and rust-lang/cargo#13028 are open to provide support for applying suggestions that may not be correct.

Qix- commented

Great, I'll subscribe to those and close this as a dupe :) Appreciate the quick response!