Skip to content

Commit ebce054

Browse files
Merge commit 'e4944185ae09c99f59b460e358909f329010ea9c' into sync-from-rustfmt-24-06
1 parent 0c5a75a commit ebce054

File tree

98 files changed

+1563
-285
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+1563
-285
lines changed

.github/workflows/integration.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ jobs:
1919
matrix:
2020
integration: [
2121
bitflags,
22-
error-chain,
2322
log,
2423
mdbook,
2524
packed_simd,

CHANGELOG.md

Lines changed: 100 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,99 @@
22

33
## [Unreleased]
44

5+
### Fixed
6+
7+
- Fix an idempotency issue when rewriting where clauses in which rustfmt would continuously add a trailing comma `,` to the end of trailing line comments [#5941](https://github.com/rust-lang/rustfmt/issues/5941).
8+
- Prevent enum variant attributes from wrapping one character early when using `version=Two` [#5801](https://github.com/rust-lang/rustfmt/issues/5801)
9+
- Properly wrap macro matchers at the `max_width` when using `version=Two` and `format_macro_matchers=true` [#3805](https://github.com/rust-lang/rustfmt/issues/3805)
10+
- Prevent panic when formatting trait declaration with non [Unicode Normalization Form] C (NFC) identifiers [#6069](https://github.com/rust-lang/rustfmt/issues/6069)
11+
```rust
12+
// The ó below is two codepoints, ASCII o followed by U+0301 COMBINING ACUTE ACCENT.
13+
// It NFC-normalizes to ó, U+00F3 LATIN SMALL LETTER O WITH ACUTE.
14+
trait Foó: Bar {}
15+
```
16+
[unicode normalization form]: https://unicode.org/reports/tr15/
17+
- Ensure a space is added to a range expression, when the right hand side of the range expression is a binary expression that ends with a trailing period [#6059](https://github.com/rust-lang/rustfmt/issues/6059)
18+
```rust
19+
let range = 3. / 2. ..4.;
20+
```
21+
- When using `version=Two`, comments in match arms that contain `=>` no longer prevent formatting [#5998](https://github.com/rust-lang/rustfmt/issues/5998)
22+
```rust
23+
match a {
24+
_ =>
25+
// comment with =>
26+
{
27+
println!("A")
28+
}
29+
}
30+
```
31+
- Prevent panics when formatting input that contains the expanded form of `offset_of!` [#5885](https://github.com/rust-lang/rustfmt/issues/5885) [#6105](https://github.com/rust-lang/rustfmt/issues/6105)
32+
```rust
33+
const _: () = builtin # offset_of(x, x);
34+
```
35+
- When using `version=Two` inner attributes in `match` expressions are correctly indented [#6147](https://github.com/rust-lang/rustfmt/issues/6147)
36+
```rust
37+
pub fn main() {
38+
match x {
39+
#![attr1]
40+
#![attr2]
41+
_ => (),
42+
}
43+
}
44+
```
45+
- Output correct syntax for type ascription builtin [#6159](https://github.com/rust-lang/rustfmt/issues/6159)
46+
```rust
47+
fn main() {
48+
builtin # type_ascribe(10, usize)
49+
}
50+
```
51+
- rustfmt no longer removes inner attributes from inline const blocks [#6158](https://github.com/rust-lang/rustfmt/issues/6158)
52+
```rust
53+
fn main() {
54+
const {
55+
#![allow(clippy::assertions_on_constants)]
56+
57+
assert!(1 < 2);
58+
}
59+
}
60+
```
61+
- rustfmt no longer removes `safe` and `unsafe` keywords from static items in extern blocks.
62+
This helps support [`#![feature(unsafe_extern_blocks)]`](https://github.com/rust-lang/rust/issues/123743) [#6204](https://github.com/rust-lang/rustfmt/pull/6204)
63+
```rust
64+
#![feature(unsafe_extern_blocks)]
65+
66+
unsafe extern "C" {
67+
safe static TEST1: i32;
68+
unsafe static TEST2: i32;
69+
}
70+
```
71+
72+
73+
### Changed
74+
75+
- `hide_parse_errors` has been soft deprecated and it's been renamed to `show_parse_errors` [#5961](https://github.com/rust-lang/rustfmt/pull/5961).
76+
- The diff output produced by `rustfmt --check` is more compatable with editors that support navigating directly to line numbers [#5971](https://github.com/rust-lang/rustfmt/pull/5971)
77+
- When using `version=Two`, the `trace!` macro from the [log crate] is now formatted similarly to `debug!`, `info!`, `warn!`, and `error!` [#5987](https://github.com/rust-lang/rustfmt/issues/5987).
78+
79+
[log crate]: https://crates.io/crates/log
80+
81+
82+
### Added
83+
84+
- `generated_marker_line_search_limit` is a new unstable configuration option that allows users to configure how many lines to search for an `@generated` marker when `format_generated_files=false` [#5658](https://github.com/rust-lang/rustfmt/issues/5658)
85+
86+
87+
### Misc
88+
89+
- Updating `dirs 4.0.0 -> 5.0.1` and `cargo_metadata 0.15.4 -> 0.18.0` [#6033] (https://github.com/rust-lang/rustfmt/issues/6033)
90+
- For reference, here's the [dirs v5 changelog](https://github.com/dirs-dev/dirs-rs/blob/main/README.md#5)
91+
- Updated [itertools v0.11 -> v0.12](https://github.com/rust-itertools/itertools/blob/v0.12.1/CHANGELOG.md#0120) [#6093](https://github.com/rust-lang/rustfmt/pull/6093)
92+
- Addressed clap deprecations output when running `cargo check --features clap/deprecated` [#6101](https://github.com/rust-lang/rustfmt/pull/6101)
93+
- Bumped bytecount `0.6.4` -> `0.6.8` to fix compilation issues with the `generic-simd` feature. See [bytecount#92] and [bytecount#93]
94+
95+
[bytecount#92]: https://github.com/llogiq/bytecount/pull/92
96+
[bytecount#93]: https://github.com/llogiq/bytecount/pull/93
97+
- Replace the `lazy_static` dependency with `std::sync::OnceLock` [#6154](https://github.com/rust-lang/rustfmt/pull/6154)
598

699
## [1.7.0] 2023-10-22
7100

@@ -27,7 +120,7 @@
27120
}
28121
```
29122
- Prevent ICE when formatting `vec!{}` [#5735](https://github.com/rust-lang/rustfmt/issues/5735)
30-
- Prevent internal trailing whitespace error when formatting an empty `macro_rules!` defintion e.g. `macro_rules! foo {}` [#5882](https://github.com/rust-lang/rustfmt/issues/5882)
123+
- Prevent internal trailing whitespace error when formatting an empty `macro_rules!` definition e.g. `macro_rules! foo {}` [#5882](https://github.com/rust-lang/rustfmt/issues/5882)
31124
- Formatting doc comment lines that start with `.` or `)` won't be treated as ordered markdown lists because `.` or `)` must be preceded by a number to start an ordered markdown list [#5835](https://github.com/rust-lang/rustfmt/pull/5835)
32125
- Add parenthesis around closures when they're used as method receives, don't have a block body, and end with `.` [#4808](https://github.com/rust-lang/rustfmt/issues/4808)
33126
```rust
@@ -184,7 +277,7 @@
184277

185278
- Simplify the rustfmt help text by eliding the full path to the rustfmt binary path from the usage string when running `rustfmt --help` [#5214](https://github.com/rust-lang/rustfmt/issues/5214)
186279

187-
- Bumped the version for serveral dependencies. Most notably `dirs` `v2.0.1` -> `v4.0.0`. This changed the global user config directory on macOS from `$HOME/Library/Preferences` to `$HOME/Library/Application Support` [#5237](https://github.com/rust-lang/rustfmt/pull/5237)
280+
- Bumped the version for several dependencies. Most notably `dirs` `v2.0.1` -> `v4.0.0`. This changed the global user config directory on macOS from `$HOME/Library/Preferences` to `$HOME/Library/Application Support` [#5237](https://github.com/rust-lang/rustfmt/pull/5237)
188281

189282
### Fixed
190283

@@ -942,7 +1035,7 @@ from formatting an attribute #3665
9421035

9431036
### Fixed
9441037

945-
- Do not remove path disambiugator inside macro #3142
1038+
- Do not remove path disambiguator inside macro #3142
9461039
- Improve handling of Windows newlines #3141
9471040
- Fix alignment of a struct's fields (`struct_field_align_threshold` option) with the Visual `indent_style` #3165
9481041
- Fix a bug in formatting markdown lists within comments #3172
@@ -1031,7 +1124,7 @@ from formatting an attribute #3665
10311124

10321125
### Changed
10331126

1034-
- Replace '--conifig-help' with '--config=help' cb10e06
1127+
- Replace '--config-help' with '--config=help' cb10e06
10351128
- Improve formatting of slice patterns #2912
10361129

10371130
### Fixed
@@ -1075,7 +1168,7 @@ from formatting an attribute #3665
10751168
- Add max_width option for all heuristics c2ae39e
10761169
- Add config option `format_macro_matchers` to format the metavariable matching patterns in macros 79c5ee8
10771170
- Add config option `format_macro_bodies` to format the bodies of macros 79c5ee8
1078-
- Format exitential type fc307ff
1171+
- Format existential type fc307ff
10791172
- Support raw identifiers in struct expressions f121b1a
10801173
- Format Async block and async function 0b25f60
10811174

@@ -1131,7 +1224,7 @@ from formatting an attribute #3665
11311224

11321225
### Changed
11331226

1134-
- Update rustc-ap-syntax to 128.0.0 and ustc-ap-rustc_target to 128.0.0 195395f
1227+
- Update rustc-ap-syntax to 128.0.0 and rustc-ap-rustc_target to 128.0.0 195395f
11351228
- Put operands on its own line when each fits in a single line f8439ce
11361229
- Improve CLI options 55ac062 1869888 798bffb 4d9de48 eca7796 8396da1 5d9f5aa
11371230

@@ -1195,7 +1288,7 @@ from formatting an attribute #3665
11951288
- Do not collapse block around expr with condition on match arm 5b9b7d5
11961289
- Use vertical layout for complex attributes c77708f
11971290
- Format array using heuristics for function calls 98c6f7b
1198-
- Implement stable ordering for impl items with the the following item priority: type, const, macro, then method fa80ddf
1291+
- Implement stable ordering for impl items with the following item priority: type, const, macro, then method fa80ddf
11991292
- Reorder imports by default 164cf7d
12001293
- Group `extern crate` by default 3a138a2
12011294
- Make `error_on_line_overflow` false by default f146711

Cargo.lock

Lines changed: 19 additions & 42 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22

33
name = "rustfmt-nightly"
4-
version = "1.7.0"
4+
version = "1.7.1"
55
description = "Tool to find and fix Rust formatting issues"
66
repository = "https://github.com/rust-lang/rustfmt"
77
readme = "README.md"
@@ -35,16 +35,15 @@ generic-simd = ["bytecount/generic-simd"]
3535
[dependencies]
3636
annotate-snippets = { version = "0.9", features = ["color"] }
3737
anyhow = "1.0"
38-
bytecount = "0.6.4"
39-
cargo_metadata = "0.15.4"
38+
bytecount = "0.6.8"
39+
cargo_metadata = "0.18"
4040
clap = { version = "4.4.2", features = ["derive"] }
4141
clap-cargo = "0.12.0"
4242
diff = "0.1"
43-
dirs = "4.0"
43+
dirs = "5.0"
4444
getopts = "0.2"
4545
ignore = "0.4"
46-
itertools = "0.11"
47-
lazy_static = "1.4"
46+
itertools = "0.12"
4847
regex = "1.7"
4948
serde = { version = "1.0.160", features = ["derive"] }
5049
serde_json = "1.0"

0 commit comments

Comments
 (0)