Auto merge of #2320 - RalfJung:less-rebuilds, r=RalfJung

reduce regex features to reduce rebuilds

Helps with the issue I [mentioned on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/269128-miri/topic/Miri.20rebuilds/near/287442340).
This commit is contained in:
bors 2022-07-03 16:31:49 +00:00
commit 984b46cc7d
4 changed files with 6 additions and 4 deletions

View File

@ -39,7 +39,8 @@ libc = "0.2"
[dev-dependencies]
colored = "2"
ui_test = { path = "ui_test" }
regex = "1.5.5"
# Features chosen to match those required by env_logger, to avoid rebuilds
regex = { version = "1.5.5", default-features = false, features = ["perf", "std"] }
lazy_static = "1.4.0"
[package.metadata.rust-analyzer]

View File

@ -10,7 +10,8 @@ doctest = false # but no doc tests
[dependencies]
rustc_version = "0.4"
colored = "2"
regex = "1.5.5"
# Features chosen to match those required by env_logger, to avoid rebuilds
regex = { version = "1.5.5", default-features = false, features = ["perf", "std"] }
pretty_assertions = "1.2.1"
crossbeam = "0.8.1"
lazy_static = "1.4.0"

View File

@ -75,7 +75,7 @@ pub(crate) fn parse_file(path: &Path) -> Self {
pub(crate) fn parse(path: &Path, content: &str) -> Self {
let mut this = Self::default();
let error_pattern_regex =
Regex::new(r"//(\[(?P<revision>[^\]]+)\])?~(?P<offset>\||[\^]+)?\s*(?P<level>ERROR|HELP|WARN|NOTE)?:?(?P<text>.*)")
Regex::new(r"//(\[(?P<revision>[^\]]+)\])?~(?P<offset>\||[\^]+)? *(?P<level>ERROR|HELP|WARN|NOTE)?:?(?P<text>.*)")
.unwrap();
// The line that a `|` will refer to

View File

@ -116,7 +116,7 @@ fn line(&self, file: &Path) -> Option<usize> {
}
pub(crate) fn filter_annotations_from_rendered(rendered: &str) -> std::borrow::Cow<'_, str> {
let annotations = Regex::new(r"\s*//(\[[^\]]\])?~.*").unwrap();
let annotations = Regex::new(r" *//(\[[^\]]\])?~.*").unwrap();
annotations.replace_all(rendered, "")
}