From 8c7b7dd041d46248950d5eca640431eaf2545972 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Fri, 9 Apr 2021 09:58:40 -0400 Subject: [PATCH] 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`. --- src/librustdoc/passes/bare_urls.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustdoc/passes/bare_urls.rs b/src/librustdoc/passes/bare_urls.rs index 3f2e1c68c55ab..524f266bcadd7 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 = SyncLazy::new(|| { +static URL_REGEX: SyncLazy = SyncLazy::new(|| { Regex::new(concat!( r"https?://", // url scheme r"([-a-zA-Z0-9@:%._\+~#=]{2,256}\.)+", // one or more subdomains