Skip to content

Commit 9725969

Browse files
committed
tidy: skip lines starting with # in alphabetical check.
These are comment lines in `Cargo.toml` files. Also allow empty lines, which are occasionally useful.
1 parent 754fe27 commit 9725969

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/tools/tidy/src/alphabetical.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
//! ```
1111
//!
1212
//! The following lines are ignored:
13+
//! - Empty lines
1314
//! - Lines that are indented with more or less spaces than the first line
1415
//! - Lines starting with `//`, `#[`, `)`, `]`, `}` if the comment has the same indentation as
1516
//! the first line
@@ -43,6 +44,10 @@ fn check_section<'a>(
4344
let mut in_split_line = None;
4445

4546
for (line_idx, line) in lines {
47+
if line.is_empty() {
48+
continue;
49+
}
50+
4651
if line.contains(START_MARKER) {
4752
tidy_error!(bad, "{file}:{} found `{START_MARKER}` expecting `{END_MARKER}`", line_idx)
4853
}
@@ -71,7 +76,7 @@ fn check_section<'a>(
7176
let trimmed_line = line.trim_start_matches(' ');
7277

7378
if trimmed_line.starts_with("//")
74-
|| trimmed_line.starts_with("#[")
79+
|| trimmed_line.starts_with("#")
7580
|| trimmed_line.starts_with(is_close_bracket)
7681
{
7782
continue;

0 commit comments

Comments
 (0)