Skip to content

Commit

Permalink
rustfmt: set imports_granularity to Item to minimize conflicts
Browse files Browse the repository at this point in the history
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:

- rust-lang/rustfmt#3361
- rust-lang/rustfmt#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
  • Loading branch information
quark-zju authored and facebook-github-bot committed Oct 19, 2021
1 parent d93fb54 commit 33bd3f9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions eden/scm/.rustfmt.toml
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 33bd3f9

Please sign in to comment.