-
Notifications
You must be signed in to change notification settings - Fork 921
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change write_mode default to overwrite #873
Comments
While I am undecided on the proposed change, please note that replace is the current default. It seems you have mixed up the behaviour of replace and overwrite. |
@marcusklaas ah good point! Fixed. (A related issue for me is that I find those setting names confusable!) |
I also just opened #888 :-) |
I'm keen to see us change on this. I think the staging proposed is a good path forward, and it'd be great to start that process. One further possibility is to change the default to overwrite if we detect version control, and replace otherwise. I'm not sure how easy it is to detect VC, but looking for |
This makes some scarily strong assumptions about people's VCS usage. I think playing it safe is better. |
I'm happy to take this on. I might use it as an excuse to do some refactoring of the CLI too... we'll see! |
@nrc is there a good idea of how many showstopper bugs exist in rustfmt that would prevent |
This would be playing it safer than always overwriting without backups though, i.e, it is less safe than today, but more safe than the proposed alternative.
Awesome, thanks!
I don't really know. I think 'showstopper' changes definition from person to person though. I'd be happy taking a bit of a risk here, since I hear a lot of complaints about backups by default. I feel like now is a good time to start advertising the change, with the intention of changing the default in 2-3 months time. We should probably track issues which would prevent us turning this on. I'll create a new label to do so. |
I created the overwrite-blocker label. |
In implementing |
whats about adding an global config file (eg: |
Closed via #1803. |
The current default of
replace
leaves behind a lot of.rs.bk
files. Users must specify--write-mode overwrite
to avoid it, or else set it inrustfmt.toml
, where it doesn't quite belong—see #871 for more on changing that.The current default is safer than
overwrite
, especially at this stage in rustfmt's development, and for users who do not commit to version control very frequently. However, eventually we will want to switch the default.To make that change safe for users, we can do something like what git did when changing the default
git push
behavior between 1.x and 2.0:write_mode
write_mode
set in their config that the default will be changing (see below for example of git's warning)write_mode
in their config that the default has changed, and that to get the old behavior they can change the setting (see below for example of git's warning)Git's pre-change warning:
Git's post-change warning:
The text was updated successfully, but these errors were encountered: