sapling/rustfmt.toml

18 lines
716 B
TOML
Raw Normal View History

# Get help on options with `rustfmt --help=config`
# Please keep these in alphabetical order.
# Prefer to keep builtin and custom derives separate
edition = "2018"
merge_derives = false
reorder_imports = true
reorder_modules = true
Update version of rustfmt specified by .rlsconfig. Summary: First, checked the following to ensure that all existing `.rlsconfig` files inherited their `rustfmt` setting from `fbcode/.rlsconfig`: ``` fbcode$ fbgf -s -l .rlsconfig | xargs rg rustfmt .rlsconfig 5: "rustfmt": "$BUCKROOT/common/rust/tools/common/rustfmt_wrapper.sh", experimental/ljw/r6/.rlsconfig 4: "rustfmt": "$BUCKROOT/common/rust/tools/common/rustfmt_wrapper.sh", experimental/ljw/r4/.rlsconfig 4: "rustfmt": "$BUCKROOT/common/rust/tools/common/rustfmt_wrapper.sh", ``` Effectively, this means that all uses of `rustfmt` via our internal Rust extension for VS Code/Nuclide should go through this script. Though to make things complicated, when an external `rustfmt` is specified to `rls`, it performs this step where it takes a complete in-memory config and serializes it to a temp file, using it as the value of `rustfmt`'s `--config-path` option. Unfortunately for us, that includes a config value named `required_version`: https://github.com/rust-lang/rustfmt/blob/master/Configurations.md#required_version It defaults to `CARGO_PKG_VERSION`, so for the current `rls` in tp2, this ends up being `1.2.2` even though we want to use it with an external `rustfmt` whose version is `1.3.3`. We can workaround this by specifying `required_version = "1.3.3"` in our own `rustfmt.toml` so that the value in the serialized config matches the version with which it will be used. Reviewed By: dtolnay Differential Revision: D17089540 fbshipit-source-id: 082ceef0f983e7cece6373603a0f318a7bc2ab2f
2019-08-28 23:13:44 +03:00
# This must be set to match the version we are currently using
# in fbsource/tools/third-party/rustfmt/rustfmt. When an external
# version of rustfmt is used with rls, it serializes the entire
# config to a temp file and passes the temp file as the value of
# `--config-path` when running rustfmt. Because we are using a
# newer version of rustfmt than rls, we must specify this here.
required_version = "1.3.3"
tab_spaces = 4
use_field_init_shorthand = true
use_try_shorthand = true