rust-lang/rustfix

Detect overlapping fixes and identical fixes

Closed this issue · 3 comments

If two fixes occur in the same area of text, rustfix will apply both and it will clash.

  • Worth having an explicit message that this is happening #94
  • and perhaps a mode between --yolo and normal mode that yolo-applies everything except when there's a clash (aside from the first fix). #94
  • Also, ignoring duplicate fixups (e.g. when a macro causes a lint -- it ends up with tons of identical replacements) would be nice.

Started a quick experiment in https://github.com/killercup/replace-rs for a lib that tracks replacements with their original spans that should be able to catch overlapping fixes. Will try and see if rustfix can easily use something this or if we need more.

(If anyone wants to make this an actually useful and good crate, let me know! I might just move this into rustfix otherwise after fixing some obvious shortcomings.)

Much happened here, but I think we should still at least add more tests, e.g., to cover macro cases.

(I hope the applicability flag will also help make this more solid)

The last point was fixed by #131