diff options
| author | Joshua Nelson <jyn514@gmail.com> | 2021-04-09 09:58:40 -0400 |
|---|---|---|
| committer | Joshua Nelson <jyn514@gmail.com> | 2021-04-09 09:58:40 -0400 |
| commit | 8c7b7dd041d46248950d5eca640431eaf2545972 (patch) | |
| tree | d06d7791eb101bbf7814f698636b9bfcfddb8945 | |
| parent | bc66b92f7f1114a78b98504a927ca9c0aa12c71a (diff) | |
| download | rust-8c7b7dd041d46248950d5eca640431eaf2545972.tar.gz rust-8c7b7dd041d46248950d5eca640431eaf2545972.zip | |
Fix perf regression in non-autolinks
Before, this was compiling the regex on every single item in the crate. This would have been caught by `clippy::declare_interior_mutable_const`.
| -rw-r--r-- | src/librustdoc/passes/bare_urls.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librustdoc/passes/bare_urls.rs b/src/librustdoc/passes/bare_urls.rs index 3f2e1c68c55..524f266bcad 100644 --- a/src/librustdoc/passes/bare_urls.rs +++ b/src/librustdoc/passes/bare_urls.rs @@ -16,7 +16,7 @@ crate const CHECK_BARE_URLS: Pass = Pass { description: "detects URLs that are not hyperlinks", }; -const URL_REGEX: SyncLazy<Regex> = SyncLazy::new(|| { +static URL_REGEX: SyncLazy<Regex> = SyncLazy::new(|| { Regex::new(concat!( r"https?://", // url scheme r"([-a-zA-Z0-9@:%._\+~#=]{2,256}\.)+", // one or more subdomains |
