Switch configuration to 2021 edition

Summary:
This results in no formatting changes for the Rust code that's in fbcode today, but it does affect the configuration of the Rust parser that `rustfmt` parses its input with.

There are some language changes between 2018 edition and 2021 edition: for example the macro input in `m!(s"")` is 2 tokens in 2018 edition and 1 token in 2021 edition. Thus even absent any formatting differences, it's possible that different error messages would be produced on a particular input by `rustfmt --edition 2018` vs `rustfmt --edition 2021`, so it's best for us to keep the rustfmt edition in sync with the edition that Buck runs rustc with, which is:

https://www.internalfb.com/code/fbsource/[b25775c8103c84ae602d9bcf297595b56f932f5a]/tools/buckconfigs/fbsource-common.bcfg?lines=324-325

Reviewed By: zertosh

Differential Revision: D35234518

fbshipit-source-id: c1b9ab47f4e592b7fd1530d39af878775cf1dc18
This commit is contained in:
David Tolnay 2022-03-29 18:29:47 -07:00 committed by Facebook GitHub Bot
parent 7213f65761
commit b351f26d3d

View file

@ -1,5 +1,5 @@
# Get help on options with `rustfmt --help=config`
# Please keep these in alphabetical order.
edition = "2018"
edition = "2021"
merge_derives = false
use_field_init_shorthand = true