From 33bd3f982c098060eab809c693d4b23f600c770a Mon Sep 17 00:00:00 2001 From: Jun Wu Date: Tue, 19 Oct 2021 11:05:23 -0700 Subject: [PATCH] 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 --- eden/scm/.rustfmt.toml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 eden/scm/.rustfmt.toml diff --git a/eden/scm/.rustfmt.toml b/eden/scm/.rustfmt.toml new file mode 100644 index 0000000000000..55a9e65673880 --- /dev/null +++ b/eden/scm/.rustfmt.toml @@ -0,0 +1,12 @@ +# Inherit from fbcode root +edition = "2018" +merge_derives = false +use_field_init_shorthand = true + +# Project specific config. +# Note: fbcode rustfmt does not respect these configs! So they cannot conflict +# with fbcode format options (i.e. run fbcode rustfmt and the result isn't +# changing). + +# To minimize conflicts, and make things easier to grep. +imports_granularity = "Item"