From 3c0062641d02940a66bc74b182aa924d141060c1 Mon Sep 17 00:00:00 2001 From: nils <48135649+Nilstrieb@users.noreply.github.com> Date: Fri, 14 Oct 2022 21:18:03 +0200 Subject: Add some tidy-alphabetical --- src/librustdoc/clean/types.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 7e053380069..4c130b2ffec 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -2540,7 +2540,7 @@ impl SubstParam { mod size_asserts { use super::*; use rustc_data_structures::static_assert_size; - // These are in alphabetical order, which is easy to maintain. + // tidy-alphabetical-start static_assert_size!(Crate, 72); // frequently moved by-value static_assert_size!(DocFragment, 32); static_assert_size!(GenericArg, 48); @@ -2550,4 +2550,5 @@ mod size_asserts { static_assert_size!(ItemKind, 88); static_assert_size!(PathSegment, 40); static_assert_size!(Type, 48); + // tidy-alphabetical-end } -- cgit 1.4.1-3-g733a5 From 1b8012fa1019dce7ecc66980a6bd810325b9c2da Mon Sep 17 00:00:00 2001 From: nils <48135649+Nilstrieb@users.noreply.github.com> Date: Fri, 14 Oct 2022 22:00:44 +0200 Subject: Also run alphabetical check in src and library --- src/tools/tidy/src/alphabetical.rs | 10 ++++------ src/tools/tidy/src/main.rs | 2 ++ 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/tools/tidy/src/alphabetical.rs b/src/tools/tidy/src/alphabetical.rs index c9f1dfb707f..f913f6cde38 100644 --- a/src/tools/tidy/src/alphabetical.rs +++ b/src/tools/tidy/src/alphabetical.rs @@ -29,7 +29,8 @@ fn is_close_bracket(c: char) -> bool { matches!(c, ')' | ']' | '}') } -const START_COMMENT: &str = "// tidy-alphabetical-start"; +// Don't let tidy check this here :D +const START_COMMENT: &str = concat!("// tidy-alphabetical", "-start"); const END_COMMENT: &str = "// tidy-alphabetical-end"; fn check_section<'a>( @@ -47,7 +48,7 @@ fn check_section<'a>( if line.contains(START_COMMENT) { tidy_error!( bad, - "{file}:{} found `// tidy-alphabetical-start` expecting `// tidy-alphabetical-end`", + "{file}:{} found `{START_COMMENT}` expecting `{END_COMMENT}`", line_idx ) } @@ -102,10 +103,7 @@ pub fn check(path: &Path, bad: &mut bool) { if line.contains(START_COMMENT) { check_section(file, &mut lines, bad); if lines.peek().is_none() { - tidy_error!( - bad, - "{file}: reached end of file expecting `// tidy-alphabetical-end`" - ) + tidy_error!(bad, "{file}: reached end of file expecting `{END_COMMENT}`") } } } diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs index 8fe361c45a2..ca785042aaa 100644 --- a/src/tools/tidy/src/main.rs +++ b/src/tools/tidy/src/main.rs @@ -90,7 +90,9 @@ fn main() { check!(edition, &compiler_path); check!(edition, &library_path); + check!(alphabetical, &src_path); check!(alphabetical, &compiler_path); + check!(alphabetical, &library_path); let collected = { while handles.len() >= concurrency.get() { -- cgit 1.4.1-3-g733a5