Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Spaces in rustic-rustfmt-args string are not divided into separate arguments #389

Closed
nickbp opened this issue Feb 20, 2022 · 2 comments
Closed

Comments

@nickbp
Copy link

nickbp commented Feb 20, 2022

As a workaround for rustfmt's insistence on ignoring the Cargo.toml edition that everything else honors, I've settled on just passing it --edition 2021 all the time, much more preferable than leaving rustfmt.toml files scattered everywhere.

However, I found that the rustic-rustfmt-args setting doesn't work with spaces. Specifically, I noticed is that this works:

(setq rustic-rustfmt-args "--edition=2021")

But this doesn't:

(setq rustic-rustfmt-args "--edition 2021")

The latter version results in the following error in a *rustfmt* buffer:

Unrecognized option: 'edition 2021'

This error can be duplicated by hand in a manual rustfmt invocation at the commandline:

$ rustfmt "--edition 2021" example.rs 
Unrecognized option: 'edition 2021'

My assumption is that multi-word rustic-rustfmt-args aren't being broken down into separate arguments. Per above, the workaround for a single argument is to avoid spaces by using the --x=y format. However this may not be an option for someone that has multiple separate arguments that they'd like to pass (like say --color=never --edition=2021?).

@brotzeit
Copy link
Owner

Thanks for the bug report. Should be a simple fix.

@brotzeit
Copy link
Owner

Should be working now.

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

No branches or pull requests

2 participants