diff options
| author | Elisha Hollander <just4now666666@gmail.com> | 2024-04-17 21:58:52 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-17 21:58:52 +0300 |
| commit | 8d0870899cf72fc4e1ff6d6e1e3457218d7da555 (patch) | |
| tree | 9fef953a7427ee2175346dd589a11bcbf47a5adf | |
| parent | da35c19311801965501cd6c417bb29a71571e925 (diff) | |
| download | rust-8d0870899cf72fc4e1ff6d6e1e3457218d7da555.tar.gz rust-8d0870899cf72fc4e1ff6d6e1e3457218d7da555.zip | |
separate regex generation
| -rw-r--r-- | src/tools/tidy/src/style.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/tools/tidy/src/style.rs b/src/tools/tidy/src/style.rs index f2902bbc634..fb5cde4b111 100644 --- a/src/tools/tidy/src/style.rs +++ b/src/tools/tidy/src/style.rs @@ -107,14 +107,13 @@ const ROOT_PROBLEMATIC_CONSTS: &[u32] = &[ 173390526, ]; -fn generate_problematic_regex( +fn generate_problematic_strings( consts: &[u32], letter_digit: &FxHashMap<char, char>, -) -> RegexSet { - RegexSet::new( - generate_problems(consts, letter_digit) - .flat_map(|v| vec![v.to_string(), format!("{:x}", v), format!("{:X}", v)]) - ).unwrap() +) -> Vec<String> { + generate_problems(consts, letter_digit) + .flat_map(|v| vec![v.to_string(), format!("{:x}", v), format!("{:X}", v)]) + .collect() } 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) { // We only check CSS files in rustdoc. path.extension().map_or(false, |e| e == "css") && !is_in(path, "src", "librustdoc") } - let problematic_regex = generate_problematic_regex( + let problematic_consts_strings = generate_problematic_strings( ROOT_PROBLEMATIC_CONSTS, &[('A', '4'), ('B', '8'), ('E', '3')].iter().cloned().collect(), ); + let problematic_regex = RegexSet::new(problematic_consts_strings.as_slice()).unwrap(); walk(path, skip, &mut |entry, contents| { let file = entry.path(); |
