From a504c0c605065f68a4d9b6cab4a475d7a1f99f39 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 6 Oct 2023 17:29:21 +1100 Subject: [PATCH 1/2] Make `tidy-alphabetical-{start,end}` work more widely. Don't restrict it to lines that have `//` in them. This means it can be used in `Cargo.toml` files, for example. --- src/tools/tidy/src/alphabetical.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/tidy/src/alphabetical.rs b/src/tools/tidy/src/alphabetical.rs index fdc411c8925..3e60915c224 100644 --- a/src/tools/tidy/src/alphabetical.rs +++ b/src/tools/tidy/src/alphabetical.rs @@ -30,8 +30,8 @@ fn is_close_bracket(c: char) -> bool { } // Don't let tidy check this here :D -const START_COMMENT: &str = concat!("// tidy-alphabetical", "-start"); -const END_COMMENT: &str = "// tidy-alphabetical-end"; +const START_COMMENT: &str = concat!("tidy-alphabetical", "-start"); +const END_COMMENT: &str = "tidy-alphabetical-end"; fn check_section<'a>( file: impl Display, From 10ab51d69d8bd540f2704e343ece5e1184a385fb Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 6 Oct 2023 17:28:36 +1100 Subject: [PATCH 2/2] Sort `rustc_driver_impl` dependencies. As per https://github.com/rust-lang/rust/blob/master/src/doc/style-guide/src/cargo.md, which says: > Sort key names alphabetically within each section, with the exception > of the [package] section. And use tidy to enforce it. --- compiler/rustc_driver_impl/Cargo.toml | 54 ++++++++++++++------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/compiler/rustc_driver_impl/Cargo.toml b/compiler/rustc_driver_impl/Cargo.toml index a7b01618ade..4894312b0d2 100644 --- a/compiler/rustc_driver_impl/Cargo.toml +++ b/compiler/rustc_driver_impl/Cargo.toml @@ -6,53 +6,55 @@ edition = "2021" [lib] [dependencies] -time = { version = "0.3", default-features = false, features = ["formatting", ] } -tracing = { version = "0.1.35" } -serde_json = "1.0.59" -rustc_log = { path = "../rustc_log" } +# tidy-alphabetical-start +rustc_ast = { path = "../rustc_ast" } rustc_ast_lowering = { path = "../rustc_ast_lowering" } rustc_ast_passes = { path = "../rustc_ast_passes" } +rustc_ast_pretty = { path = "../rustc_ast_pretty" } rustc_attr = { path = "../rustc_attr" } rustc_borrowck = { path = "../rustc_borrowck" } rustc_builtin_macros = { path = "../rustc_builtin_macros" } +rustc_codegen_ssa = { path = "../rustc_codegen_ssa" } rustc_const_eval = { path = "../rustc_const_eval" } +rustc_data_structures = { path = "../rustc_data_structures" } +rustc_error_codes = { path = "../rustc_error_codes" } rustc_error_messages = { path = "../rustc_error_messages" } +rustc_errors = { path = "../rustc_errors" } rustc_expand = { path = "../rustc_expand" } -rustc_hir_typeck = { path = "../rustc_hir_typeck" } +rustc_feature = { path = "../rustc_feature" } rustc_fluent_macro = { path = "../rustc_fluent_macro" } +rustc_hir = { path = "../rustc_hir" } +rustc_hir_analysis = { path = "../rustc_hir_analysis" } +rustc_hir_pretty = { path = "../rustc_hir_pretty" } +rustc_hir_typeck = { path = "../rustc_hir_typeck" } rustc_incremental = { path = "../rustc_incremental" } rustc_infer = { path = "../rustc_infer" } +rustc_interface = { path = "../rustc_interface" } +rustc_lint = { path = "../rustc_lint" } +rustc_log = { path = "../rustc_log" } +rustc_macros = { path = "../rustc_macros" } +rustc_metadata = { path = "../rustc_metadata" } +rustc_middle = { path = "../rustc_middle" } rustc_mir_build = { path = "../rustc_mir_build" } rustc_mir_dataflow = { path = "../rustc_mir_dataflow" } +rustc_mir_transform = { path = "../rustc_mir_transform" } rustc_monomorphize = { path = "../rustc_monomorphize" } +rustc_parse = { path = "../rustc_parse" } rustc_passes = { path = "../rustc_passes" } +rustc_plugin_impl = { path = "../rustc_plugin_impl" } rustc_privacy = { path = "../rustc_privacy" } rustc_query_system = { path = "../rustc_query_system" } rustc_resolve = { path = "../rustc_resolve" } +rustc_session = { path = "../rustc_session" } +rustc_span = { path = "../rustc_span" } rustc_symbol_mangling = { path = "../rustc_symbol_mangling" } +rustc_target = { path = "../rustc_target" } rustc_trait_selection = { path = "../rustc_trait_selection" } rustc_ty_utils = { path = "../rustc_ty_utils" } -rustc_middle = { path = "../rustc_middle" } -rustc_ast_pretty = { path = "../rustc_ast_pretty" } -rustc_target = { path = "../rustc_target" } -rustc_lint = { path = "../rustc_lint" } -rustc_data_structures = { path = "../rustc_data_structures" } -rustc_errors = { path = "../rustc_errors" } -rustc_feature = { path = "../rustc_feature" } -rustc_hir = { path = "../rustc_hir" } -rustc_hir_pretty = { path = "../rustc_hir_pretty" } -rustc_macros = { path = "../rustc_macros" } -rustc_metadata = { path = "../rustc_metadata" } -rustc_parse = { path = "../rustc_parse" } -rustc_plugin_impl = { path = "../rustc_plugin_impl" } -rustc_codegen_ssa = { path = "../rustc_codegen_ssa" } -rustc_session = { path = "../rustc_session" } -rustc_error_codes = { path = "../rustc_error_codes" } -rustc_interface = { path = "../rustc_interface" } -rustc_ast = { path = "../rustc_ast" } -rustc_span = { path = "../rustc_span" } -rustc_hir_analysis = { path = "../rustc_hir_analysis" } -rustc_mir_transform = { path = "../rustc_mir_transform" } +serde_json = "1.0.59" +time = { version = "0.3", default-features = false, features = ["formatting", ] } +tracing = { version = "0.1.35" } +# tidy-alphabetical-end [target.'cfg(unix)'.dependencies] libc = "0.2"