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

Use cargo fmt instead of rustfmt #289

Closed
vmalloc opened this issue Dec 8, 2018 · 4 comments · Fixed by #338
Closed

Use cargo fmt instead of rustfmt #289

vmalloc opened this issue Dec 8, 2018 · 4 comments · Fixed by #338

Comments

@vmalloc
Copy link

vmalloc commented Dec 8, 2018

For Rust 2018, rustfmt does not work correctly (e.g. removes leading :: from use statements. The fact that rust-mode runs it instead of cargo fmt makes it problematic for writing 2018 code...

It would be nice to have this mode use the recommended cargo fmt command instead of rustfmt.

Thanks in advance!

@das-sein
Copy link

das-sein commented Feb 4, 2019

Could you provide a code snippet that it's formatting incorrectly? I'm not experiencing this issue myself, but am wondering if using rustfmt is actually the issue here. While playing with replacing the rustfmt calls, I found that cargo fmt itself will pass arguments to rustfmt given the -- argument.

@vmalloc
Copy link
Author

vmalloc commented Feb 5, 2019

I stumbled upon it as a part of the Rust 2018 changes - where rustfmt did not respect the "Edition" directive in cargo.toml. I guess this is no longer the case so the priority of this should not be that critical IMO

@agrover
Copy link

agrover commented Aug 17, 2019

Certainly still seems to be the case for me. See rust-lang/rustfmt#3724

@topecongiro
Copy link

rustfmt does not respect Cargo.toml because it is intended for a stand-alone tool, even without cargo. You could still pass --edition 2018 to rustfmt to let it understand that the files being passed use edition 2018.

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

Successfully merging a pull request may close this issue.

4 participants