Skip to content

Commit 248a10e

Browse files
committed
reduce regex features to reduce rebuilds
1 parent a4e7e1e commit 248a10e

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ libc = "0.2"
3939
[dev-dependencies]
4040
colored = "2"
4141
ui_test = { path = "ui_test" }
42-
regex = "1.5.5"
42+
# Features chosen to match those required by env_logger, to avoid rebuilds
43+
regex = { version = "1.5.5", default-features = false, features = ["perf", "std"] }
4344
lazy_static = "1.4.0"
4445

4546
[package.metadata.rust-analyzer]

ui_test/Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ edition = "2021"
88
[dependencies]
99
rustc_version = "0.4"
1010
colored = "2"
11-
regex = "1.5.5"
11+
# Features chosen to match those required by env_logger, to avoid rebuilds
12+
regex = { version = "1.5.5", default-features = false, features = ["perf", "std"] }
1213
pretty_assertions = "1.2.1"
1314
crossbeam = "0.8.1"
1415
lazy_static = "1.4.0"

ui_test/src/comments.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl Comments {
7575
pub(crate) fn parse(path: &Path, content: &str) -> Self {
7676
let mut this = Self::default();
7777
let error_pattern_regex =
78-
Regex::new(r"//(\[(?P<revision>[^\]]+)\])?~(?P<offset>\||[\^]+)?\s*(?P<level>ERROR|HELP|WARN|NOTE)?:?(?P<text>.*)")
78+
Regex::new(r"//(\[(?P<revision>[^\]]+)\])?~(?P<offset>\||[\^]+)? *(?P<level>ERROR|HELP|WARN|NOTE)?:?(?P<text>.*)")
7979
.unwrap();
8080

8181
// The line that a `|` will refer to

ui_test/src/rustc_stderr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ impl Span {
116116
}
117117

118118
pub(crate) fn filter_annotations_from_rendered(rendered: &str) -> std::borrow::Cow<'_, str> {
119-
let annotations = Regex::new(r"\s*//(\[[^\]]\])?~.*").unwrap();
119+
let annotations = Regex::new(r" *//(\[[^\]]\])?~.*").unwrap();
120120
annotations.replace_all(rendered, "")
121121
}
122122

0 commit comments

Comments
 (0)