2019-01-10 00:25:07 +03:00
|
|
|
# Get help on options with `rustfmt --help=config`
|
2017-07-28 04:00:19 +03:00
|
|
|
# Please keep these in alphabetical order.
|
2019-01-10 00:25:07 +03:00
|
|
|
# Prefer to keep builtin and custom derives separate
|
2019-05-30 05:51:37 +03:00
|
|
|
edition = "2018"
|
2017-09-06 03:23:00 +03:00
|
|
|
merge_derives = false
|
2017-07-28 04:00:19 +03:00
|
|
|
reorder_imports = true
|
2019-01-10 00:25:07 +03:00
|
|
|
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"
|
2017-07-28 04:00:19 +03:00
|
|
|
tab_spaces = 4
|
2019-01-10 00:25:07 +03:00
|
|
|
use_field_init_shorthand = true
|
2017-07-28 04:00:19 +03:00
|
|
|
use_try_shorthand = true
|