Skip to content

Commit 1b8012f

Browse files
committed
Also run alphabetical check in src and library
1 parent 3c00626 commit 1b8012f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/tools/tidy/src/alphabetical.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ fn is_close_bracket(c: char) -> bool {
2929
matches!(c, ')' | ']' | '}')
3030
}
3131

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

3536
fn check_section<'a>(
@@ -47,7 +48,7 @@ fn check_section<'a>(
4748
if line.contains(START_COMMENT) {
4849
tidy_error!(
4950
bad,
50-
"{file}:{} found `// tidy-alphabetical-start` expecting `// tidy-alphabetical-end`",
51+
"{file}:{} found `{START_COMMENT}` expecting `{END_COMMENT}`",
5152
line_idx
5253
)
5354
}
@@ -102,10 +103,7 @@ pub fn check(path: &Path, bad: &mut bool) {
102103
if line.contains(START_COMMENT) {
103104
check_section(file, &mut lines, bad);
104105
if lines.peek().is_none() {
105-
tidy_error!(
106-
bad,
107-
"{file}: reached end of file expecting `// tidy-alphabetical-end`"
108-
)
106+
tidy_error!(bad, "{file}: reached end of file expecting `{END_COMMENT}`")
109107
}
110108
}
111109
}

src/tools/tidy/src/main.rs

+2
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ fn main() {
9090
check!(edition, &compiler_path);
9191
check!(edition, &library_path);
9292

93+
check!(alphabetical, &src_path);
9394
check!(alphabetical, &compiler_path);
95+
check!(alphabetical, &library_path);
9496

9597
let collected = {
9698
while handles.len() >= concurrency.get() {

0 commit comments

Comments
 (0)