From 11fef0c91ae274abbd82e56c849d3aaaf34b6839 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Fri, 31 Jan 2025 07:26:49 -0800 Subject: [PATCH] Remove rustfmt-overflow-delimited-expr This has been dropped from the edition via https://github.com/rust-lang/rust/pull/136312. --- src/SUMMARY.md | 1 - .../rustfmt-overflow-delimited-expr.md | 90 ------------------- 2 files changed, 91 deletions(-) delete mode 100644 src/rust-2024/rustfmt-overflow-delimited-expr.md diff --git a/src/SUMMARY.md b/src/SUMMARY.md index 51c916f..68cc012 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -67,6 +67,5 @@ - [Rustfmt](rust-2024/rustfmt.md) - [Rustfmt: Style edition](rust-2024/rustfmt-style-edition.md) - [Rustfmt: Formatting fixes](rust-2024/rustfmt-formatting-fixes.md) - - [Rustfmt: Combine all delimited exprs as last argument](rust-2024/rustfmt-overflow-delimited-expr.md) - [Rustfmt: Raw identifier sorting](rust-2024/rustfmt-raw-identifier-sorting.md) - [Rustfmt: Version sorting](rust-2024/rustfmt-version-sorting.md) diff --git a/src/rust-2024/rustfmt-overflow-delimited-expr.md b/src/rust-2024/rustfmt-overflow-delimited-expr.md deleted file mode 100644 index 1d12e85..0000000 --- a/src/rust-2024/rustfmt-overflow-delimited-expr.md +++ /dev/null @@ -1,90 +0,0 @@ -# Rustfmt: Combine all delimited exprs as last argument - -## Summary - -* Some expressions with multi-line final arguments will now format as a single line, with the final expression overflowing. - -## Details - -When structs, slices, arrays, and block/array-like macros are used as the last argument in an expression list, they are now allowed to overflow (like blocks/closures) instead of being indented on a new line. - -```rust,ignore -// Edition 2021 - -fn example() { - foo(ctx, |param| { - action(); - foo(param) - }); - - foo( - ctx, - Bar { - x: value, - y: value2, - }, - ); - - foo( - ctx, - &[ - MAROON_TOMATOES, - PURPLE_POTATOES, - ORGANE_ORANGES, - GREEN_PEARS, - RED_APPLES, - ], - ); - - foo( - ctx, - vec![ - MAROON_TOMATOES, - PURPLE_POTATOES, - ORGANE_ORANGES, - GREEN_PEARS, - RED_APPLES, - ], - ); -} -``` - -This now formats as the following in the 2024 style edition: - -```rust,ignore -// Edition 2024 - -fn example() { - foo(ctx, |param| { - action(); - foo(param) - }); - - foo(ctx, Bar { - x: value, - y: value2, - }); - - foo(ctx, &[ - MAROON_TOMATOES, - PURPLE_POTATOES, - ORGANE_ORANGES, - GREEN_PEARS, - RED_APPLES, - ]); - - foo(ctx, vec![ - MAROON_TOMATOES, - PURPLE_POTATOES, - ORGANE_ORANGES, - GREEN_PEARS, - RED_APPLES, - ]); -} -``` - -## Migration - -The change can be applied automatically by running `cargo fmt` or `rustfmt` with the 2024 Edition. See the [Style edition] chapter for more information on migrating and how style editions work. - -[Style edition]: rustfmt-style-edition.md