HenningHolmDE / hcloud-rust

Unofficial Rust crate for accessing the Hetzner Cloud API
Other
64 stars 7 forks source link

Can't ignore paths in rustfmt without Nightly #13

Closed good-praxis closed 2 years ago

good-praxis commented 2 years ago

When running cargo fmt, I get the following errors:

Warning: can't set `ignore = IgnoreList { path_set: {"src/apis", "src/models"}, rustfmt_toml_path: "" }`, unstable features are only available in nightly channel.
Warning: can't set `ignore = IgnoreList { path_set: {"src/models", "src/apis"}, rustfmt_toml_path: "" }`, unstable features are only available in nightly channel.
Warning: can't set `ignore = IgnoreList { path_set: {"src/apis", "src/models"}, rustfmt_toml_path: "" }`, unstable features are only available in nightly channel.
Warning: can't set `ignore = IgnoreList { path_set: {"src/apis", "src/models"}, rustfmt_toml_path: "" }`, unstable features are only available in nightly channel.
Warning: can't set `ignore = IgnoreList { path_set: {"src/models", "src/apis"}, rustfmt_toml_path: "" }`, unstable features are only available in nightly channel.

Is there a reason we opt to not format the generated files? Doesn't it make them easier to parse for the human eye? And since the templates don't change on every code change, it's not like every commit will update the formatting of the templates

kpcyrd commented 2 years ago

I think this is related to https://github.com/rust-lang/rustfmt/pull/4139 and https://github.com/rust-lang/rustfmt/issues/3395

HenningHolmDE commented 2 years ago

Thanks for reporting the issue.

Is there a reason we opt to not format the generated files?

While I still know I excluded the generated files on purpose (and therefore had to switch fmt to nightly for that), I cannot remember why I thought that not formatting the generated code was a good idea. :(

So I guess we can add cargo fmt to the post-processing steps in generate_api_code.sh and get rid of the exclude.