Skip to content

Commit 8b64b52

Browse files
committed
Prepare PR #321 to be merged
We needed to add an entry to the ToC, and we made various editorial tweaks.
1 parent 0cbff13 commit 8b64b52

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
- [Cargo: Table and key name consistency](rust-2024/cargo-table-key-names.md)
4949
- [Cargo: Reject unused inherited default-features](rust-2024/cargo-inherited-default-features.md)
5050
- [Rustfmt: Combine all delimited exprs as last argument](rust-2024/rustfmt-overflow-delimited-expr.md)
51+
- [Rustfmt: Raw identifier sorting](rust-2024/rustfmt-raw-identifier-sorting.md)
5152
- [`gen` keyword](rust-2024/gen-keyword.md)
5253
- [Macro fragment specifiers](rust-2024/macro-fragment-specifiers.md)
5354
- [Missing macro fragment specifiers](rust-2024/missing-macro-fragment-specifiers.md)

src/rust-2024/rustfmt-raw-identifiers.md renamed to src/rust-2024/rustfmt-raw-identifier-sorting.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,49 @@
1-
# Rustfmt: raw identifier sorting
1+
# Rustfmt: Raw identifier sorting
22

33
🚧 The 2024 Edition has not yet been released and hence this section is still "under construction".
44

5-
More information may be found in <https://github.com/rust-lang/rust/issues/124764>.
5+
More information may be found in the tracking issue at <https://github.com/rust-lang/rust/issues/124764>.
66

77
## Summary
88

99
`rustfmt` now properly sorts [raw identifiers].
1010

11-
[raw identifiers]: https://doc.rust-lang.org/rust-by-example/compatibility/raw_identifiers.html
11+
[raw identifiers]: ../../reference/identifiers.html#raw-identifiers
1212

1313
## Details
1414

1515
The [Rust Style Guide] includes [rules for sorting][sorting] that `rustfmt` applies in various contexts, such as on imports.
1616

17-
Prior to the 2024 Edition, when sorting rustfmt would use the leading `r#` token instead of the ident which led to specious results.
18-
19-
For example:
17+
Prior to the 2024 Edition, when sorting rustfmt would use the leading `r#` token instead of the ident which led to unwanted results. For example:
2018

2119
```rust
2220
use websocket::client::ClientBuilder;
2321
use websocket::r#async::futures::Stream;
2422
use websocket::result::WebSocketError;
2523
```
2624

27-
Which is now corrected in the 2024 Edition:
25+
In the 2024 Edition, `rustfmt` now produces:
2826

2927
```rust
3028
use websocket::r#async::futures::Stream;
3129
use websocket::client::ClientBuilder;
3230
use websocket::result::WebSocketError;
3331
```
3432

35-
[Rust Style Guide]: https://doc.rust-lang.org/nightly/style-guide/index.html
36-
[sorting]: https://doc.rust-lang.org/stable/style-guide/index.html?highlight=sort#sorting
33+
[Rust Style Guide]: ../../style-guide/index.html
34+
[sorting]: ../../style-guide/index.html#sorting
3735

3836
## Migration
3937

4038
The change can be applied automatically by running `cargo fmt` or `rustfmt` with the 2024 Edition.
4139

42-
With a Cargo.toml file that has `edition` set to `2024`:
40+
With a `Cargo.toml` file that has `edition` set to `2024`, run:
4341

4442
```sh
4543
cargo fmt
4644
```
4745

48-
Or by running `rustfmt` directly:
46+
Or run `rustfmt` directly:
4947

5048
```sh
5149
rustfmt foo.rs --style-edition 2024

0 commit comments

Comments
 (0)