Skip to content
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

Do not reformat on input error #3989

Closed
dhardy opened this issue Jan 1, 2020 · 1 comment · Fixed by #4256
Closed

Do not reformat on input error #3989

dhardy opened this issue Jan 1, 2020 · 1 comment · Fixed by #4256
Milestone

Comments

@dhardy
Copy link

dhardy commented Jan 1, 2020

Could rustfmt not reformat on error, but with command-line option to override, please?

Rationale: I enter some invalid code (e.g. #![rustfmt::max_width(120)], which is not a valid rustfmt attribute), run cargo fmt, and get an error. Because rustfmt still changed the file in question I lose my editor's history (unless overriding its desire to reload a changed file), thus adjusting the invalid item becomes harder.

(BTW, is per-file/item configuration a thing? It would be nice sometimes.)

@calebcartwright
Copy link
Member

(BTW, is per-file/item configuration a thing? It would be nice sometimes.)

AFAIK, inline config settings/overrides are not supported though that sounds like it could be a useful feature!

It's not per-file, but you can have multiple rustfmt config files though for different mods/directories if you want different settings for different files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants