Skip to content

Commit c07693c

Browse files
committed
Auto merge of #116477 - nnethercote:tidy-alpha-deps, r=wesleywiser
Use tidy to enforce alphabetical dependency ordering I get annoyed when dependencies in `Cargo.toml` files are not in alphabetical order. The [style guide](https://github.com/rust-lang/rust/blob/master/src/doc/style-guide/src/cargo.md) agrees with me. There are ongoing efforts to provide linting/formatting of `Cargo.toml` files, e.g. rust-lang/rustfmt#5240, https://crates.io/crates/cargo-toml-lint, and https://github.com/TimonPost/cargo-toml-format. But it's far from clear what's the right approach. So this PR does something very simple: it uses the order checking already present in tidy. This allows incremental application of ordering, starting right now, and avoiding the need for any kind of all-at-once conversion. If we do end up using some more comprehensive `Cargo.toml` linting/formatting solution in the future, the `tidy-alphabetical` lines will be easy to remove. r? `@wesleywiser`
2 parents 39164b8 + 10ab51d commit c07693c

File tree

2 files changed

+30
-28
lines changed

2 files changed

+30
-28
lines changed

compiler/rustc_driver_impl/Cargo.toml

+28-26
Original file line numberDiff line numberDiff line change
@@ -6,53 +6,55 @@ edition = "2021"
66
[lib]
77

88
[dependencies]
9-
time = { version = "0.3", default-features = false, features = ["formatting", ] }
10-
tracing = { version = "0.1.35" }
11-
serde_json = "1.0.59"
12-
rustc_log = { path = "../rustc_log" }
9+
# tidy-alphabetical-start
10+
rustc_ast = { path = "../rustc_ast" }
1311
rustc_ast_lowering = { path = "../rustc_ast_lowering" }
1412
rustc_ast_passes = { path = "../rustc_ast_passes" }
13+
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
1514
rustc_attr = { path = "../rustc_attr" }
1615
rustc_borrowck = { path = "../rustc_borrowck" }
1716
rustc_builtin_macros = { path = "../rustc_builtin_macros" }
17+
rustc_codegen_ssa = { path = "../rustc_codegen_ssa" }
1818
rustc_const_eval = { path = "../rustc_const_eval" }
19+
rustc_data_structures = { path = "../rustc_data_structures" }
20+
rustc_error_codes = { path = "../rustc_error_codes" }
1921
rustc_error_messages = { path = "../rustc_error_messages" }
22+
rustc_errors = { path = "../rustc_errors" }
2023
rustc_expand = { path = "../rustc_expand" }
21-
rustc_hir_typeck = { path = "../rustc_hir_typeck" }
24+
rustc_feature = { path = "../rustc_feature" }
2225
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
26+
rustc_hir = { path = "../rustc_hir" }
27+
rustc_hir_analysis = { path = "../rustc_hir_analysis" }
28+
rustc_hir_pretty = { path = "../rustc_hir_pretty" }
29+
rustc_hir_typeck = { path = "../rustc_hir_typeck" }
2330
rustc_incremental = { path = "../rustc_incremental" }
2431
rustc_infer = { path = "../rustc_infer" }
32+
rustc_interface = { path = "../rustc_interface" }
33+
rustc_lint = { path = "../rustc_lint" }
34+
rustc_log = { path = "../rustc_log" }
35+
rustc_macros = { path = "../rustc_macros" }
36+
rustc_metadata = { path = "../rustc_metadata" }
37+
rustc_middle = { path = "../rustc_middle" }
2538
rustc_mir_build = { path = "../rustc_mir_build" }
2639
rustc_mir_dataflow = { path = "../rustc_mir_dataflow" }
40+
rustc_mir_transform = { path = "../rustc_mir_transform" }
2741
rustc_monomorphize = { path = "../rustc_monomorphize" }
42+
rustc_parse = { path = "../rustc_parse" }
2843
rustc_passes = { path = "../rustc_passes" }
44+
rustc_plugin_impl = { path = "../rustc_plugin_impl" }
2945
rustc_privacy = { path = "../rustc_privacy" }
3046
rustc_query_system = { path = "../rustc_query_system" }
3147
rustc_resolve = { path = "../rustc_resolve" }
48+
rustc_session = { path = "../rustc_session" }
49+
rustc_span = { path = "../rustc_span" }
3250
rustc_symbol_mangling = { path = "../rustc_symbol_mangling" }
51+
rustc_target = { path = "../rustc_target" }
3352
rustc_trait_selection = { path = "../rustc_trait_selection" }
3453
rustc_ty_utils = { path = "../rustc_ty_utils" }
35-
rustc_middle = { path = "../rustc_middle" }
36-
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
37-
rustc_target = { path = "../rustc_target" }
38-
rustc_lint = { path = "../rustc_lint" }
39-
rustc_data_structures = { path = "../rustc_data_structures" }
40-
rustc_errors = { path = "../rustc_errors" }
41-
rustc_feature = { path = "../rustc_feature" }
42-
rustc_hir = { path = "../rustc_hir" }
43-
rustc_hir_pretty = { path = "../rustc_hir_pretty" }
44-
rustc_macros = { path = "../rustc_macros" }
45-
rustc_metadata = { path = "../rustc_metadata" }
46-
rustc_parse = { path = "../rustc_parse" }
47-
rustc_plugin_impl = { path = "../rustc_plugin_impl" }
48-
rustc_codegen_ssa = { path = "../rustc_codegen_ssa" }
49-
rustc_session = { path = "../rustc_session" }
50-
rustc_error_codes = { path = "../rustc_error_codes" }
51-
rustc_interface = { path = "../rustc_interface" }
52-
rustc_ast = { path = "../rustc_ast" }
53-
rustc_span = { path = "../rustc_span" }
54-
rustc_hir_analysis = { path = "../rustc_hir_analysis" }
55-
rustc_mir_transform = { path = "../rustc_mir_transform" }
54+
serde_json = "1.0.59"
55+
time = { version = "0.3", default-features = false, features = ["formatting", ] }
56+
tracing = { version = "0.1.35" }
57+
# tidy-alphabetical-end
5658

5759
[target.'cfg(unix)'.dependencies]
5860
libc = "0.2"

src/tools/tidy/src/alphabetical.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ fn is_close_bracket(c: char) -> bool {
3030
}
3131

3232
// Don't let tidy check this here :D
33-
const START_COMMENT: &str = concat!("// tidy-alphabetical", "-start");
34-
const END_COMMENT: &str = "// tidy-alphabetical-end";
33+
const START_COMMENT: &str = concat!("tidy-alphabetical", "-start");
34+
const END_COMMENT: &str = "tidy-alphabetical-end";
3535

3636
fn check_section<'a>(
3737
file: impl Display,

0 commit comments

Comments
 (0)