Skip to content

Commit 8d08708

Browse files
authored
separate regex generation
1 parent da35c19 commit 8d08708

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/tools/tidy/src/style.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,13 @@ const ROOT_PROBLEMATIC_CONSTS: &[u32] = &[
107107
173390526,
108108
];
109109

110-
fn generate_problematic_regex(
110+
fn generate_problematic_strings(
111111
consts: &[u32],
112112
letter_digit: &FxHashMap<char, char>,
113-
) -> RegexSet {
114-
RegexSet::new(
115-
generate_problems(consts, letter_digit)
116-
.flat_map(|v| vec![v.to_string(), format!("{:x}", v), format!("{:X}", v)])
117-
).unwrap()
113+
) -> Vec<String> {
114+
generate_problems(consts, letter_digit)
115+
.flat_map(|v| vec![v.to_string(), format!("{:x}", v), format!("{:X}", v)])
116+
.collect()
118117
}
119118

120119
const INTERNAL_COMPILER_DOCS_LINE: &str = "#### This error code is internal to the compiler and will not be emitted with normal Rust code.";
@@ -313,10 +312,11 @@ pub fn check(path: &Path, bad: &mut bool) {
313312
// We only check CSS files in rustdoc.
314313
path.extension().map_or(false, |e| e == "css") && !is_in(path, "src", "librustdoc")
315314
}
316-
let problematic_regex = generate_problematic_regex(
315+
let problematic_consts_strings = generate_problematic_strings(
317316
ROOT_PROBLEMATIC_CONSTS,
318317
&[('A', '4'), ('B', '8'), ('E', '3')].iter().cloned().collect(),
319318
);
319+
let problematic_regex = RegexSet::new(problematic_consts_strings.as_slice()).unwrap();
320320

321321
walk(path, skip, &mut |entry, contents| {
322322
let file = entry.path();

0 commit comments

Comments
 (0)