rustfix icon indicating copy to clipboard operation
rustfix copied to clipboard

Dry-run functionality

Open ozkriff opened this issue 6 years ago • 9 comments

Is something like --dry-run planned? Or rustfix will always require a VCS?

ozkriff avatar Sep 17 '18 11:09 ozkriff

I'm not sure I understand. What would --dry-run do? Not change the files? Isn't that basically the same as doing cargo check instead of cargo fix, then?

killercup avatar Sep 17 '18 11:09 killercup

Oh, and depending on your answer, this seems like an issue better suited for the cargo repository, as the cargo fix tool lives there (cf. https://github.com/rust-lang/cargo/issues?utf8=✓&q=is%3Aissue+label%3ACommand-fix+). This repo only contains the rustfix library.

killercup avatar Sep 17 '18 11:09 killercup

It would print out a diff of what it would change. with cargo check you still have to wonder about which suggestions would get applied, and how

On Mon, Sep 17, 2018, 5:22 PM Pascal Hertleif [email protected] wrote:

I'm not sure I understand. What would --dry-run do? Not change the files? Isn't that basically the same as doing cargo check instead of cargo fix, then?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rust-lang-nursery/rustfix/issues/146#issuecomment-421983195, or mute the thread https://github.com/notifications/unsubscribe-auth/ABivSI-MvL3FDHxMG1b4KSWp_zJXzKEiks5ub4zqgaJpZM4WrsnG .

Manishearth avatar Sep 17 '18 11:09 Manishearth

From the 1.29 blog post:

The compiler has an API for this, and it only suggests fixing lints that we’re confident recommend correct code.

As far as I understand, not all warnings showed by cargo check are fixed by rustfix.

ozkriff avatar Sep 17 '18 11:09 ozkriff

Ah, I see, writing the diff is an interesting idea. In theory you can write it to a .patch file, too, then.

Do you want to open this issue on the cargo repo, @ozkriff? Otherwise I can do it (but you probably have some concrete idea and use cases you could describe, too).

killercup avatar Sep 17 '18 11:09 killercup

Do you want to open this issue on the cargo repo, @ozkriff?

:+1: Will do in a few minutes.

you probably have some concrete idea and use cases you could describe

Actually, no, I was just asked about this in the comments to russian translation of 1.29 announcement.

ozkriff avatar Sep 17 '18 12:09 ozkriff

Done: https://github.com/rust-lang/cargo/issues/6040

ozkriff avatar Sep 17 '18 12:09 ozkriff

I think this library will also need support for doing all this without editing, no?

Manishearth avatar Sep 17 '18 12:09 Manishearth

@Manishearth nah, all file handling is done in the cargo subcommand

killercup avatar Sep 17 '18 12:09 killercup