Commit Graph

2 Commits

Author SHA1 Message Date
Jun Wu
bafd80784e rustfmt: set group_imports to StdExternalCrate
Summary:
The `group_imports = "StdExternalCrate"` config might be a bit controversial
since some might prefer a single block. However, the only automated option
by rustfmt is StdExternalCrate. The single block behavior isn't a choice.

Forcing this makes the codebase a bit more consistent.

Reviewed By: yancouto

Differential Revision: D31746732

fbshipit-source-id: b3fc3a7ee20302ece585c8ac3c4f189b25bc1425
2021-10-19 11:07:24 -07:00
Jun Wu
33bd3f982c rustfmt: set imports_granularity to Item to minimize conflicts
Summary:
To make the codebase a bit more consistent and reduce conflicts. Similar to
Java.

Note: The fbsource Rust lint does not respect this file so it cannot conflict
with the fbcode rustfmt config. That means a more preserving (for what to group
in `{}` and what not), less controversial (when to use `{}` grouping is
controversial) choice `imports_layout = "HorizontalVertical"` (like
[black](https://github.com/psf/black) in Python) cannot be used at present.

See also:

- https://github.com/rust-lang/rustfmt/issues/3361
- https://github.com/rust-lang/rustfmt/issues/3362
- https://fb.workplace.com/groups/rust.language/posts/6720351014680123/
- https://fb.workplace.com/groups/rust.language/posts/5429720200409884/

This adds the config without changing the files.

Reviewed By: yancouto

Differential Revision: D31746731

fbshipit-source-id: 8e171829fd53691a59bf3b80cdc500c0b3993ba5
2021-10-19 11:07:23 -07:00