Skip to content

Commit 19ca9a4

Browse files
Support code backticks in feature name capitalization check
1 parent 5773838 commit 19ca9a4

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

xtask/src/codegen/feature_docs.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,20 +58,27 @@ impl Feature {
5858
}
5959

6060
fn is_valid_feature_name(feature: &str) -> Result<(), String> {
61+
let mut in_code = false;
6162
'word: for word in feature.split_whitespace() {
62-
for short in ["to", "and"] {
63+
for short in ["to", "and", "of"] {
6364
if word == short {
6465
continue 'word;
6566
}
6667
}
67-
for short in ["To", "And"] {
68+
for short in ["To", "And", "Of"] {
6869
if word == short {
6970
return Err(format!("Don't capitalize {word:?}"));
7071
}
7172
}
72-
if !word.starts_with(char::is_uppercase) {
73+
if word.starts_with('`') {
74+
in_code = true;
75+
}
76+
if !in_code && !word.starts_with(char::is_uppercase) {
7377
return Err(format!("Capitalize {word:?}"));
7478
}
79+
if word.ends_with('`') {
80+
in_code = false;
81+
}
7582
}
7683
Ok(())
7784
}

0 commit comments

Comments
 (0)