Skip to content

Commit

Permalink
fix(.rustfmt.toml): specify Rust edition 2021 (#1722)
Browse files Browse the repository at this point in the history
* fix(.rustfmt.toml): specify Rust edition 2021

Emacs' popular Rust plugin Rustic [1] uses `rustfmt` to format code. `rustfmt`
only picks up the Rust edition from `Cargo.toml` when executed through `cargo fmt` [2] [3].

This commit duplicates the Rust edition in the `.rustfmt.toml` file. Thus all
users of `rustfmt` (whether through `cargo fmt` or plain `rustfmt`) will get
formatting according to their Rust edition, e.g. helpful when interacting with
`async` code.

[1]: https://github.com/brotzeit/rustic
[2]: https://github.com/brotzeit/rustic?tab=readme-ov-file#edition-2018
[3]: https://github.com/rust-lang/rustfmt?tab=readme-ov-file#rusts-editions

* Document keeping edition statements in sync
  • Loading branch information
mxinden authored Mar 8, 2024
1 parent 4a6ec6f commit 3476bd0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# Keep in sync with `Cargo.toml` `edition`.
#
# `rustfmt` envoked not through `cargo fmt` but directly does not pick up Rust
# edition in `Cargo.toml`. Thus duplicate here. See
# https://github.com/mozilla/neqo/pull/1722 for details.
edition = "2021"

comment_width=100
wrap_comments=true

Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ homepage = "https://github.com/mozilla/neqo/"
repository = "https://github.com/mozilla/neqo/"
authors = ["The Neqo Authors <[email protected]>"]
version = "0.7.1"
# Keep in sync with `.rustfmt.toml` `edition`.
edition = "2021"
license = "MIT OR Apache-2.0"
# Don't increase beyond what Firefox is currently using:
Expand Down

0 comments on commit 3476bd0

Please sign in to comment.