Open wyfo opened 2 years ago
@wyfo feel free to post a PR which adds a corresponding paragraph in CONTRIBUTING.md. As long as default cargo fmt
is fine with your proposal, I am too (: @piodul?
Yes, enforcing a consistent import style is a good idea. I did some research and it turns that we can go further and enforce them in CI - you can provide additional options in the .rustfmt.toml
file (reference). I believe we would be interested in the following options:
imports_granularity = "Module"
group_imports = "StdExternalCrate"
However, these options are:
I think we should try adding those checks to CI, but only after we close most of the current actively developed/reviewed PRs. Not sure if the paragraph in CONTRIBUTING.md would be needed after that, but I guess it won't hurt.
Thoughts? @psarna @wyfo
Sounds great, nightly isn't an issue for CI indeed, we can add another job that does validation on a nightly toolchain. A paragraph in CONTRIBUTING.md can't hurt either way, but it's not mandatory after the rules are enforced by our CI.
Yes, it sounds great. Does the choice imports_granularity = "Module"
vs imports_granularity = "Crate"
need to be debated? :innocent:
I know that TiKV (and @wprzytula) uses the second, and I tend to agree with them. Module
formatting, on the other hand, seems more common, and would surely reformat less code.
This is a pure code style issue.
I've resolved today a merge conflict in
transport/cluster.rs
because imports had been modified in the meantime by https://github.com/scylladb/scylla-rust-driver/commit/9bf4f74f421faf76122b30c78ec61299fba1783a.The issue here was
against
I don't want to argue about the style itself, but to avoid this kind of conflict, I suggest to enforce the import style, for example in
CONTRIBUTING.md
.