From d8079a664383df04dc9891d783b09433da04e13f Mon Sep 17 00:00:00 2001 From: Caleb Cartwright Date: Wed, 16 Oct 2024 23:08:51 -0500 Subject: [PATCH] feat: apply 2024 version sort algorithm to mods --- src/reorder.rs | 24 ++++++++-- tests/source/reorder_modules/A2/mod.rs | 1 + tests/source/reorder_modules/ABCD/mod.rs | 1 + tests/source/reorder_modules/ZYXW/mod.rs | 1 + tests/source/reorder_modules/ZYXW_/mod.rs | 1 + tests/source/reorder_modules/ZY_XW/mod.rs | 1 + tests/source/reorder_modules/Z_YXW/mod.rs | 1 + tests/source/reorder_modules/_ZYXW/mod.rs | 1 + tests/source/reorder_modules/_abcd/mod.rs | 1 + tests/source/reorder_modules/a1/mod.rs | 1 + tests/source/reorder_modules/abcd/mod.rs | 1 + .../disabled_style_edition_2024.rs | 47 +++++++++++++++++++ .../enabled_style_edition_2015.rs | 47 +++++++++++++++++++ .../enabled_style_edition_2024.rs | 47 +++++++++++++++++++ tests/source/reorder_modules/u128/mod.rs | 1 + tests/source/reorder_modules/u16/mod.rs | 1 + tests/source/reorder_modules/u256/mod.rs | 1 + tests/source/reorder_modules/u32/mod.rs | 1 + tests/source/reorder_modules/u64/mod.rs | 1 + tests/source/reorder_modules/u8/mod.rs | 1 + tests/source/reorder_modules/u_zzz/mod.rs | 1 + tests/source/reorder_modules/ua/mod.rs | 1 + tests/source/reorder_modules/usize/mod.rs | 1 + tests/source/reorder_modules/uz/mod.rs | 1 + tests/source/reorder_modules/v0/mod.rs | 1 + tests/source/reorder_modules/v00/mod.rs | 1 + tests/source/reorder_modules/v000/mod.rs | 1 + tests/source/reorder_modules/v001/mod.rs | 1 + tests/source/reorder_modules/v009/mod.rs | 1 + tests/source/reorder_modules/v00t/mod.rs | 1 + tests/source/reorder_modules/v01/mod.rs | 1 + tests/source/reorder_modules/v010/mod.rs | 1 + tests/source/reorder_modules/v09/mod.rs | 1 + tests/source/reorder_modules/v0s/mod.rs | 1 + tests/source/reorder_modules/v0u/mod.rs | 1 + tests/source/reorder_modules/v1/mod.rs | 1 + tests/source/reorder_modules/v10/mod.rs | 1 + tests/source/reorder_modules/v9/mod.rs | 1 + tests/source/reorder_modules/w005s09t/mod.rs | 1 + tests/source/reorder_modules/w5s009t/mod.rs | 1 + tests/source/reorder_modules/x64/mod.rs | 1 + tests/source/reorder_modules/x86/mod.rs | 1 + tests/source/reorder_modules/x86_128/mod.rs | 1 + tests/source/reorder_modules/x86_32/mod.rs | 1 + tests/source/reorder_modules/x86_64/mod.rs | 1 + tests/source/reorder_modules/x87/mod.rs | 1 + tests/source/reorder_modules/zyxw/mod.rs | 1 + tests/target/reorder_modules/A2/mod.rs | 1 + tests/target/reorder_modules/ABCD/mod.rs | 1 + tests/target/reorder_modules/ZYXW/mod.rs | 1 + tests/target/reorder_modules/ZYXW_/mod.rs | 1 + tests/target/reorder_modules/ZY_XW/mod.rs | 1 + tests/target/reorder_modules/Z_YXW/mod.rs | 1 + tests/target/reorder_modules/_ZYXW/mod.rs | 1 + tests/target/reorder_modules/_abcd/mod.rs | 1 + tests/target/reorder_modules/a1/mod.rs | 1 + tests/target/reorder_modules/abcd/mod.rs | 1 + .../disabled_style_edition_2024.rs | 47 +++++++++++++++++++ .../enabled_style_edition_2015.rs | 47 +++++++++++++++++++ .../enabled_style_edition_2024.rs | 47 +++++++++++++++++++ tests/target/reorder_modules/u128/mod.rs | 1 + tests/target/reorder_modules/u16/mod.rs | 1 + tests/target/reorder_modules/u256/mod.rs | 1 + tests/target/reorder_modules/u32/mod.rs | 1 + tests/target/reorder_modules/u64/mod.rs | 1 + tests/target/reorder_modules/u8/mod.rs | 1 + tests/target/reorder_modules/u_zzz/mod.rs | 1 + tests/target/reorder_modules/ua/mod.rs | 1 + tests/target/reorder_modules/usize/mod.rs | 1 + tests/target/reorder_modules/uz/mod.rs | 1 + tests/target/reorder_modules/v0/mod.rs | 1 + tests/target/reorder_modules/v00/mod.rs | 1 + tests/target/reorder_modules/v000/mod.rs | 1 + tests/target/reorder_modules/v001/mod.rs | 1 + tests/target/reorder_modules/v009/mod.rs | 1 + tests/target/reorder_modules/v00t/mod.rs | 1 + tests/target/reorder_modules/v01/mod.rs | 1 + tests/target/reorder_modules/v010/mod.rs | 1 + tests/target/reorder_modules/v09/mod.rs | 1 + tests/target/reorder_modules/v0s/mod.rs | 1 + tests/target/reorder_modules/v0u/mod.rs | 1 + tests/target/reorder_modules/v1/mod.rs | 1 + tests/target/reorder_modules/v10/mod.rs | 1 + tests/target/reorder_modules/v9/mod.rs | 1 + tests/target/reorder_modules/w005s09t/mod.rs | 1 + tests/target/reorder_modules/w5s009t/mod.rs | 1 + tests/target/reorder_modules/x64/mod.rs | 1 + tests/target/reorder_modules/x86/mod.rs | 1 + tests/target/reorder_modules/x86_128/mod.rs | 1 + tests/target/reorder_modules/x86_32/mod.rs | 1 + tests/target/reorder_modules/x86_64/mod.rs | 1 + tests/target/reorder_modules/x87/mod.rs | 1 + tests/target/reorder_modules/zyxw/mod.rs | 1 + 93 files changed, 387 insertions(+), 5 deletions(-) create mode 100644 tests/source/reorder_modules/A2/mod.rs create mode 100644 tests/source/reorder_modules/ABCD/mod.rs create mode 100644 tests/source/reorder_modules/ZYXW/mod.rs create mode 100644 tests/source/reorder_modules/ZYXW_/mod.rs create mode 100644 tests/source/reorder_modules/ZY_XW/mod.rs create mode 100644 tests/source/reorder_modules/Z_YXW/mod.rs create mode 100644 tests/source/reorder_modules/_ZYXW/mod.rs create mode 100644 tests/source/reorder_modules/_abcd/mod.rs create mode 100644 tests/source/reorder_modules/a1/mod.rs create mode 100644 tests/source/reorder_modules/abcd/mod.rs create mode 100644 tests/source/reorder_modules/disabled_style_edition_2024.rs create mode 100644 tests/source/reorder_modules/enabled_style_edition_2015.rs create mode 100644 tests/source/reorder_modules/enabled_style_edition_2024.rs create mode 100644 tests/source/reorder_modules/u128/mod.rs create mode 100644 tests/source/reorder_modules/u16/mod.rs create mode 100644 tests/source/reorder_modules/u256/mod.rs create mode 100644 tests/source/reorder_modules/u32/mod.rs create mode 100644 tests/source/reorder_modules/u64/mod.rs create mode 100644 tests/source/reorder_modules/u8/mod.rs create mode 100644 tests/source/reorder_modules/u_zzz/mod.rs create mode 100644 tests/source/reorder_modules/ua/mod.rs create mode 100644 tests/source/reorder_modules/usize/mod.rs create mode 100644 tests/source/reorder_modules/uz/mod.rs create mode 100644 tests/source/reorder_modules/v0/mod.rs create mode 100644 tests/source/reorder_modules/v00/mod.rs create mode 100644 tests/source/reorder_modules/v000/mod.rs create mode 100644 tests/source/reorder_modules/v001/mod.rs create mode 100644 tests/source/reorder_modules/v009/mod.rs create mode 100644 tests/source/reorder_modules/v00t/mod.rs create mode 100644 tests/source/reorder_modules/v01/mod.rs create mode 100644 tests/source/reorder_modules/v010/mod.rs create mode 100644 tests/source/reorder_modules/v09/mod.rs create mode 100644 tests/source/reorder_modules/v0s/mod.rs create mode 100644 tests/source/reorder_modules/v0u/mod.rs create mode 100644 tests/source/reorder_modules/v1/mod.rs create mode 100644 tests/source/reorder_modules/v10/mod.rs create mode 100644 tests/source/reorder_modules/v9/mod.rs create mode 100644 tests/source/reorder_modules/w005s09t/mod.rs create mode 100644 tests/source/reorder_modules/w5s009t/mod.rs create mode 100644 tests/source/reorder_modules/x64/mod.rs create mode 100644 tests/source/reorder_modules/x86/mod.rs create mode 100644 tests/source/reorder_modules/x86_128/mod.rs create mode 100644 tests/source/reorder_modules/x86_32/mod.rs create mode 100644 tests/source/reorder_modules/x86_64/mod.rs create mode 100644 tests/source/reorder_modules/x87/mod.rs create mode 100644 tests/source/reorder_modules/zyxw/mod.rs create mode 100644 tests/target/reorder_modules/A2/mod.rs create mode 100644 tests/target/reorder_modules/ABCD/mod.rs create mode 100644 tests/target/reorder_modules/ZYXW/mod.rs create mode 100644 tests/target/reorder_modules/ZYXW_/mod.rs create mode 100644 tests/target/reorder_modules/ZY_XW/mod.rs create mode 100644 tests/target/reorder_modules/Z_YXW/mod.rs create mode 100644 tests/target/reorder_modules/_ZYXW/mod.rs create mode 100644 tests/target/reorder_modules/_abcd/mod.rs create mode 100644 tests/target/reorder_modules/a1/mod.rs create mode 100644 tests/target/reorder_modules/abcd/mod.rs create mode 100644 tests/target/reorder_modules/disabled_style_edition_2024.rs create mode 100644 tests/target/reorder_modules/enabled_style_edition_2015.rs create mode 100644 tests/target/reorder_modules/enabled_style_edition_2024.rs create mode 100644 tests/target/reorder_modules/u128/mod.rs create mode 100644 tests/target/reorder_modules/u16/mod.rs create mode 100644 tests/target/reorder_modules/u256/mod.rs create mode 100644 tests/target/reorder_modules/u32/mod.rs create mode 100644 tests/target/reorder_modules/u64/mod.rs create mode 100644 tests/target/reorder_modules/u8/mod.rs create mode 100644 tests/target/reorder_modules/u_zzz/mod.rs create mode 100644 tests/target/reorder_modules/ua/mod.rs create mode 100644 tests/target/reorder_modules/usize/mod.rs create mode 100644 tests/target/reorder_modules/uz/mod.rs create mode 100644 tests/target/reorder_modules/v0/mod.rs create mode 100644 tests/target/reorder_modules/v00/mod.rs create mode 100644 tests/target/reorder_modules/v000/mod.rs create mode 100644 tests/target/reorder_modules/v001/mod.rs create mode 100644 tests/target/reorder_modules/v009/mod.rs create mode 100644 tests/target/reorder_modules/v00t/mod.rs create mode 100644 tests/target/reorder_modules/v01/mod.rs create mode 100644 tests/target/reorder_modules/v010/mod.rs create mode 100644 tests/target/reorder_modules/v09/mod.rs create mode 100644 tests/target/reorder_modules/v0s/mod.rs create mode 100644 tests/target/reorder_modules/v0u/mod.rs create mode 100644 tests/target/reorder_modules/v1/mod.rs create mode 100644 tests/target/reorder_modules/v10/mod.rs create mode 100644 tests/target/reorder_modules/v9/mod.rs create mode 100644 tests/target/reorder_modules/w005s09t/mod.rs create mode 100644 tests/target/reorder_modules/w5s009t/mod.rs create mode 100644 tests/target/reorder_modules/x64/mod.rs create mode 100644 tests/target/reorder_modules/x86/mod.rs create mode 100644 tests/target/reorder_modules/x86_128/mod.rs create mode 100644 tests/target/reorder_modules/x86_32/mod.rs create mode 100644 tests/target/reorder_modules/x86_64/mod.rs create mode 100644 tests/target/reorder_modules/x87/mod.rs create mode 100644 tests/target/reorder_modules/zyxw/mod.rs diff --git a/src/reorder.rs b/src/reorder.rs index 8a31e0ac816..3df05b885e3 100644 --- a/src/reorder.rs +++ b/src/reorder.rs @@ -11,29 +11,40 @@ use std::cmp::Ordering; use rustc_ast::{ast, attr}; use rustc_span::{Span, symbol::sym}; +use crate::StyleEdition; use crate::config::{Config, GroupImportsTactic}; use crate::imports::{UseSegmentKind, UseTree, normalize_use_trees_with_granularity}; use crate::items::{is_mod_decl, rewrite_extern_crate, rewrite_mod}; use crate::lists::{ListFormatting, ListItem, itemize_list, write_list}; use crate::rewrite::{RewriteContext, RewriteErrorExt}; use crate::shape::Shape; +use crate::sort::version_sort; use crate::source_map::LineRangeUtils; use crate::spanned::Spanned; use crate::utils::{contains_skip, mk_sp}; use crate::visitor::FmtVisitor; /// Choose the ordering between the given two items. -fn compare_items(a: &ast::Item, b: &ast::Item) -> Ordering { +fn compare_items(a: &ast::Item, b: &ast::Item, context: &RewriteContext<'_>) -> Ordering { + let style_edition = context.config.style_edition(); match (&a.kind, &b.kind) { (&ast::ItemKind::Mod(..), &ast::ItemKind::Mod(..)) => { - a.ident.as_str().cmp(b.ident.as_str()) + if style_edition <= StyleEdition::Edition2021 { + a.ident.as_str().cmp(b.ident.as_str()) + } else { + version_sort(a.ident.as_str(), b.ident.as_str()) + } } (&ast::ItemKind::ExternCrate(ref a_name), &ast::ItemKind::ExternCrate(ref b_name)) => { // `extern crate foo as bar;` // ^^^ Comparing this. let a_orig_name = a_name.unwrap_or(a.ident.name); let b_orig_name = b_name.unwrap_or(b.ident.name); - let result = a_orig_name.as_str().cmp(b_orig_name.as_str()); + let result = if style_edition <= StyleEdition::Edition2021 { + a_orig_name.as_str().cmp(b_orig_name.as_str()) + } else { + version_sort(a_orig_name.as_str(), b_orig_name.as_str()) + }; if result != Ordering::Equal { return result; } @@ -44,7 +55,10 @@ fn compare_items(a: &ast::Item, b: &ast::Item) -> Ordering { (Some(..), None) => Ordering::Greater, (None, Some(..)) => Ordering::Less, (None, None) => Ordering::Equal, - (Some(..), Some(..)) => a.ident.as_str().cmp(b.ident.as_str()), + (Some(..), Some(..)) if style_edition <= StyleEdition::Edition2021 => { + a.ident.as_str().cmp(b.ident.as_str()) + } + (Some(..), Some(..)) => version_sort(a.ident.as_str(), b.ident.as_str()), } } _ => unreachable!(), @@ -165,7 +179,7 @@ fn rewrite_reorderable_or_regroupable_items( ); let mut item_pair_vec: Vec<_> = list_items.zip(reorderable_items.iter()).collect(); - item_pair_vec.sort_by(|a, b| compare_items(a.1, b.1)); + item_pair_vec.sort_by(|a, b| compare_items(a.1, b.1, context)); let item_vec: Vec<_> = item_pair_vec.into_iter().map(|pair| pair.0).collect(); wrap_reorderable_items(context, &item_vec, shape) diff --git a/tests/source/reorder_modules/A2/mod.rs b/tests/source/reorder_modules/A2/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/A2/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/ABCD/mod.rs b/tests/source/reorder_modules/ABCD/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/ABCD/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/ZYXW/mod.rs b/tests/source/reorder_modules/ZYXW/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/ZYXW/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/ZYXW_/mod.rs b/tests/source/reorder_modules/ZYXW_/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/ZYXW_/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/ZY_XW/mod.rs b/tests/source/reorder_modules/ZY_XW/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/ZY_XW/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/Z_YXW/mod.rs b/tests/source/reorder_modules/Z_YXW/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/Z_YXW/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/_ZYXW/mod.rs b/tests/source/reorder_modules/_ZYXW/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/_ZYXW/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/_abcd/mod.rs b/tests/source/reorder_modules/_abcd/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/_abcd/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/a1/mod.rs b/tests/source/reorder_modules/a1/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/a1/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/abcd/mod.rs b/tests/source/reorder_modules/abcd/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/abcd/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/disabled_style_edition_2024.rs b/tests/source/reorder_modules/disabled_style_edition_2024.rs new file mode 100644 index 00000000000..d97f9a6da74 --- /dev/null +++ b/tests/source/reorder_modules/disabled_style_edition_2024.rs @@ -0,0 +1,47 @@ +// rustfmt-style_edition: 2024 +// rustfmt-reorder_modules: false + +mod x86; +mod v0s; +mod v001; +mod x87; +mod zyxw; +mod A2; +mod ZYXW; +mod w5s009t; +mod u8; +mod x86_128; +mod _ZYXW; +mod ZY_XW; +mod a1; +mod v01; +mod v0u; +mod x86_64; +mod ua; +mod x86_32; +mod v9; +mod v010; +mod u_zzz; +mod v0; +mod v00; +mod v009; +mod w005s09t; +mod u32; +mod v1; +mod v00t; +mod v09; +mod u256; +mod ZY_XW; +mod _abcd; +mod ABCD; +mod Z_YXW; +mod u64; +mod abcd; +mod ZYXW_; +mod u16; +mod uz; +mod v10; +mod x64; +mod u128; +mod usize; +mod v000; diff --git a/tests/source/reorder_modules/enabled_style_edition_2015.rs b/tests/source/reorder_modules/enabled_style_edition_2015.rs new file mode 100644 index 00000000000..0243a1da849 --- /dev/null +++ b/tests/source/reorder_modules/enabled_style_edition_2015.rs @@ -0,0 +1,47 @@ +// rustfmt-style_edition: 2015 +// rustfmt-reorder_modules: true + +mod x86; +mod v0s; +mod v001; +mod x87; +mod zyxw; +mod A2; +mod ZYXW; +mod w5s009t; +mod u8; +mod x86_128; +mod _ZYXW; +mod ZY_XW; +mod a1; +mod v01; +mod v0u; +mod x86_64; +mod ua; +mod x86_32; +mod v9; +mod v010; +mod u_zzz; +mod v0; +mod v00; +mod v009; +mod w005s09t; +mod u32; +mod v1; +mod v00t; +mod v09; +mod u256; +mod ZY_XW; +mod _abcd; +mod ABCD; +mod Z_YXW; +mod u64; +mod abcd; +mod ZYXW_; +mod u16; +mod uz; +mod v10; +mod x64; +mod u128; +mod usize; +mod v000; diff --git a/tests/source/reorder_modules/enabled_style_edition_2024.rs b/tests/source/reorder_modules/enabled_style_edition_2024.rs new file mode 100644 index 00000000000..6a9a5c8d607 --- /dev/null +++ b/tests/source/reorder_modules/enabled_style_edition_2024.rs @@ -0,0 +1,47 @@ +// rustfmt-style_edition: 2024 +// rustfmt-reorder_modules: true + +mod x86; +mod v0s; +mod v001; +mod x87; +mod zyxw; +mod A2; +mod ZYXW; +mod w5s009t; +mod u8; +mod x86_128; +mod _ZYXW; +mod ZY_XW; +mod a1; +mod v01; +mod v0u; +mod x86_64; +mod ua; +mod x86_32; +mod v9; +mod v010; +mod u_zzz; +mod v0; +mod v00; +mod v009; +mod w005s09t; +mod u32; +mod v1; +mod v00t; +mod v09; +mod u256; +mod ZY_XW; +mod _abcd; +mod ABCD; +mod Z_YXW; +mod u64; +mod abcd; +mod ZYXW_; +mod u16; +mod uz; +mod v10; +mod x64; +mod u128; +mod usize; +mod v000; diff --git a/tests/source/reorder_modules/u128/mod.rs b/tests/source/reorder_modules/u128/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/u128/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/u16/mod.rs b/tests/source/reorder_modules/u16/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/u16/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/u256/mod.rs b/tests/source/reorder_modules/u256/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/u256/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/u32/mod.rs b/tests/source/reorder_modules/u32/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/u32/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/u64/mod.rs b/tests/source/reorder_modules/u64/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/u64/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/u8/mod.rs b/tests/source/reorder_modules/u8/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/u8/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/u_zzz/mod.rs b/tests/source/reorder_modules/u_zzz/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/u_zzz/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/ua/mod.rs b/tests/source/reorder_modules/ua/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/ua/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/usize/mod.rs b/tests/source/reorder_modules/usize/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/usize/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/uz/mod.rs b/tests/source/reorder_modules/uz/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/uz/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/v0/mod.rs b/tests/source/reorder_modules/v0/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/v0/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/v00/mod.rs b/tests/source/reorder_modules/v00/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/v00/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/v000/mod.rs b/tests/source/reorder_modules/v000/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/v000/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/v001/mod.rs b/tests/source/reorder_modules/v001/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/v001/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/v009/mod.rs b/tests/source/reorder_modules/v009/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/v009/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/v00t/mod.rs b/tests/source/reorder_modules/v00t/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/v00t/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/v01/mod.rs b/tests/source/reorder_modules/v01/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/v01/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/v010/mod.rs b/tests/source/reorder_modules/v010/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/v010/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/v09/mod.rs b/tests/source/reorder_modules/v09/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/v09/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/v0s/mod.rs b/tests/source/reorder_modules/v0s/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/v0s/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/v0u/mod.rs b/tests/source/reorder_modules/v0u/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/v0u/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/v1/mod.rs b/tests/source/reorder_modules/v1/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/v1/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/v10/mod.rs b/tests/source/reorder_modules/v10/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/v10/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/v9/mod.rs b/tests/source/reorder_modules/v9/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/v9/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/w005s09t/mod.rs b/tests/source/reorder_modules/w005s09t/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/w005s09t/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/w5s009t/mod.rs b/tests/source/reorder_modules/w5s009t/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/w5s009t/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/x64/mod.rs b/tests/source/reorder_modules/x64/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/x64/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/x86/mod.rs b/tests/source/reorder_modules/x86/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/x86/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/x86_128/mod.rs b/tests/source/reorder_modules/x86_128/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/x86_128/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/x86_32/mod.rs b/tests/source/reorder_modules/x86_32/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/x86_32/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/x86_64/mod.rs b/tests/source/reorder_modules/x86_64/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/x86_64/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/x87/mod.rs b/tests/source/reorder_modules/x87/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/x87/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/source/reorder_modules/zyxw/mod.rs b/tests/source/reorder_modules/zyxw/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/source/reorder_modules/zyxw/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/A2/mod.rs b/tests/target/reorder_modules/A2/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/A2/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/ABCD/mod.rs b/tests/target/reorder_modules/ABCD/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/ABCD/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/ZYXW/mod.rs b/tests/target/reorder_modules/ZYXW/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/ZYXW/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/ZYXW_/mod.rs b/tests/target/reorder_modules/ZYXW_/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/ZYXW_/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/ZY_XW/mod.rs b/tests/target/reorder_modules/ZY_XW/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/ZY_XW/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/Z_YXW/mod.rs b/tests/target/reorder_modules/Z_YXW/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/Z_YXW/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/_ZYXW/mod.rs b/tests/target/reorder_modules/_ZYXW/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/_ZYXW/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/_abcd/mod.rs b/tests/target/reorder_modules/_abcd/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/_abcd/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/a1/mod.rs b/tests/target/reorder_modules/a1/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/a1/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/abcd/mod.rs b/tests/target/reorder_modules/abcd/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/abcd/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/disabled_style_edition_2024.rs b/tests/target/reorder_modules/disabled_style_edition_2024.rs new file mode 100644 index 00000000000..d97f9a6da74 --- /dev/null +++ b/tests/target/reorder_modules/disabled_style_edition_2024.rs @@ -0,0 +1,47 @@ +// rustfmt-style_edition: 2024 +// rustfmt-reorder_modules: false + +mod x86; +mod v0s; +mod v001; +mod x87; +mod zyxw; +mod A2; +mod ZYXW; +mod w5s009t; +mod u8; +mod x86_128; +mod _ZYXW; +mod ZY_XW; +mod a1; +mod v01; +mod v0u; +mod x86_64; +mod ua; +mod x86_32; +mod v9; +mod v010; +mod u_zzz; +mod v0; +mod v00; +mod v009; +mod w005s09t; +mod u32; +mod v1; +mod v00t; +mod v09; +mod u256; +mod ZY_XW; +mod _abcd; +mod ABCD; +mod Z_YXW; +mod u64; +mod abcd; +mod ZYXW_; +mod u16; +mod uz; +mod v10; +mod x64; +mod u128; +mod usize; +mod v000; diff --git a/tests/target/reorder_modules/enabled_style_edition_2015.rs b/tests/target/reorder_modules/enabled_style_edition_2015.rs new file mode 100644 index 00000000000..b3831df6d86 --- /dev/null +++ b/tests/target/reorder_modules/enabled_style_edition_2015.rs @@ -0,0 +1,47 @@ +// rustfmt-style_edition: 2015 +// rustfmt-reorder_modules: true + +mod A2; +mod ABCD; +mod ZYXW; +mod ZYXW_; +mod ZY_XW; +mod ZY_XW; +mod Z_YXW; +mod _ZYXW; +mod _abcd; +mod a1; +mod abcd; +mod u128; +mod u16; +mod u256; +mod u32; +mod u64; +mod u8; +mod u_zzz; +mod ua; +mod usize; +mod uz; +mod v0; +mod v00; +mod v000; +mod v001; +mod v009; +mod v00t; +mod v01; +mod v010; +mod v09; +mod v0s; +mod v0u; +mod v1; +mod v10; +mod v9; +mod w005s09t; +mod w5s009t; +mod x64; +mod x86; +mod x86_128; +mod x86_32; +mod x86_64; +mod x87; +mod zyxw; diff --git a/tests/target/reorder_modules/enabled_style_edition_2024.rs b/tests/target/reorder_modules/enabled_style_edition_2024.rs new file mode 100644 index 00000000000..ad78762aa01 --- /dev/null +++ b/tests/target/reorder_modules/enabled_style_edition_2024.rs @@ -0,0 +1,47 @@ +// rustfmt-style_edition: 2024 +// rustfmt-reorder_modules: true + +mod _ZYXW; +mod _abcd; +mod A2; +mod ABCD; +mod Z_YXW; +mod ZY_XW; +mod ZY_XW; +mod ZYXW; +mod ZYXW_; +mod a1; +mod abcd; +mod u_zzz; +mod u8; +mod u16; +mod u32; +mod u64; +mod u128; +mod u256; +mod ua; +mod usize; +mod uz; +mod v000; +mod v00; +mod v0; +mod v0s; +mod v00t; +mod v0u; +mod v001; +mod v01; +mod v1; +mod v009; +mod v09; +mod v9; +mod v010; +mod v10; +mod w005s09t; +mod w5s009t; +mod x64; +mod x86; +mod x86_32; +mod x86_64; +mod x86_128; +mod x87; +mod zyxw; diff --git a/tests/target/reorder_modules/u128/mod.rs b/tests/target/reorder_modules/u128/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/u128/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/u16/mod.rs b/tests/target/reorder_modules/u16/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/u16/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/u256/mod.rs b/tests/target/reorder_modules/u256/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/u256/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/u32/mod.rs b/tests/target/reorder_modules/u32/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/u32/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/u64/mod.rs b/tests/target/reorder_modules/u64/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/u64/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/u8/mod.rs b/tests/target/reorder_modules/u8/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/u8/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/u_zzz/mod.rs b/tests/target/reorder_modules/u_zzz/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/u_zzz/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/ua/mod.rs b/tests/target/reorder_modules/ua/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/ua/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/usize/mod.rs b/tests/target/reorder_modules/usize/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/usize/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/uz/mod.rs b/tests/target/reorder_modules/uz/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/uz/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/v0/mod.rs b/tests/target/reorder_modules/v0/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/v0/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/v00/mod.rs b/tests/target/reorder_modules/v00/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/v00/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/v000/mod.rs b/tests/target/reorder_modules/v000/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/v000/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/v001/mod.rs b/tests/target/reorder_modules/v001/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/v001/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/v009/mod.rs b/tests/target/reorder_modules/v009/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/v009/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/v00t/mod.rs b/tests/target/reorder_modules/v00t/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/v00t/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/v01/mod.rs b/tests/target/reorder_modules/v01/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/v01/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/v010/mod.rs b/tests/target/reorder_modules/v010/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/v010/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/v09/mod.rs b/tests/target/reorder_modules/v09/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/v09/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/v0s/mod.rs b/tests/target/reorder_modules/v0s/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/v0s/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/v0u/mod.rs b/tests/target/reorder_modules/v0u/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/v0u/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/v1/mod.rs b/tests/target/reorder_modules/v1/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/v1/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/v10/mod.rs b/tests/target/reorder_modules/v10/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/v10/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/v9/mod.rs b/tests/target/reorder_modules/v9/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/v9/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/w005s09t/mod.rs b/tests/target/reorder_modules/w005s09t/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/w005s09t/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/w5s009t/mod.rs b/tests/target/reorder_modules/w5s009t/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/w5s009t/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/x64/mod.rs b/tests/target/reorder_modules/x64/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/x64/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/x86/mod.rs b/tests/target/reorder_modules/x86/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/x86/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/x86_128/mod.rs b/tests/target/reorder_modules/x86_128/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/x86_128/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/x86_32/mod.rs b/tests/target/reorder_modules/x86_32/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/x86_32/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/x86_64/mod.rs b/tests/target/reorder_modules/x86_64/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/x86_64/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/x87/mod.rs b/tests/target/reorder_modules/x87/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/x87/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/target/reorder_modules/zyxw/mod.rs b/tests/target/reorder_modules/zyxw/mod.rs new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/target/reorder_modules/zyxw/mod.rs @@ -0,0 +1 @@ +