Skip to content

Commit 781ce9d

Browse files
tests: validate style_edition derivation
Adds a few tests that validate the various scenarios of precendence, overrides, and defaults to ensure the correct 'style_edition' value is selected even when other options like 'edition' and/or 'version' are included.
1 parent d7f40ff commit 781ce9d

File tree

6 files changed

+49
-2
lines changed

6 files changed

+49
-2
lines changed

Diff for: tests/target/configs/indent_style/block_trailing_comma_call/one.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-version: One
1+
// rustfmt-style_edition: 2015
22
// rustfmt-error_on_line_overflow: false
33
// rustfmt-indent_style: Block
44

Diff for: tests/target/configs/indent_style/block_trailing_comma_call/two.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-version: Two
1+
// rustfmt-style_edition: 2024
22
// rustfmt-error_on_line_overflow: false
33
// rustfmt-indent_style: Block
44

Diff for: tests/target/configs/version/mapped.rs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// rustfmt-version: Two
2+
fn main() {
3+
let [
4+
aaaaaaaaaaaaaaaaaaaaaaaaaa,
5+
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
6+
cccccccccccccccccccccccccc,
7+
ddddddddddddddddddddddddd,
8+
] = panic!();
9+
}

Diff for: tests/target/style_edition/default.rs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
fn build_sorted_static_get_entry_names(
2+
mut entries: Vec<(u8, &'static str)>,
3+
) -> (impl Fn(
4+
AlphabeticalTraversal,
5+
Box<dyn dirents_sink::Sink<AlphabeticalTraversal>>,
6+
) -> BoxFuture<'static, Result<Box<dyn dirents_sink::Sealed>, Status>>
7+
+ Send
8+
+ Sync
9+
+ 'static) {
10+
}

Diff for: tests/target/style_edition/follows_edition.rs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// rustfmt-edition: 2024
2+
3+
fn build_sorted_static_get_entry_names(
4+
mut entries: Vec<(u8, &'static str)>,
5+
) -> (
6+
impl Fn(
7+
AlphabeticalTraversal,
8+
Box<dyn dirents_sink::Sink<AlphabeticalTraversal>>,
9+
) -> BoxFuture<'static, Result<Box<dyn dirents_sink::Sealed>, Status>>
10+
+ Send
11+
+ Sync
12+
+ 'static
13+
) {
14+
}
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// rustfmt-edition: 2018
2+
// rustfmt-style_edition: 2024
3+
fn build_sorted_static_get_entry_names(
4+
mut entries: Vec<(u8, &'static str)>,
5+
) -> (
6+
impl Fn(
7+
AlphabeticalTraversal,
8+
Box<dyn dirents_sink::Sink<AlphabeticalTraversal>>,
9+
) -> BoxFuture<'static, Result<Box<dyn dirents_sink::Sealed>, Status>>
10+
+ Send
11+
+ Sync
12+
+ 'static
13+
) {
14+
}

0 commit comments

Comments
 (0)