diff options
Diffstat (limited to 'vendor/mdbook/src/utils/string.rs')
-rw-r--r-- | vendor/mdbook/src/utils/string.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/vendor/mdbook/src/utils/string.rs b/vendor/mdbook/src/utils/string.rs index 97485d7b6..6dafe2603 100644 --- a/vendor/mdbook/src/utils/string.rs +++ b/vendor/mdbook/src/utils/string.rs @@ -1,3 +1,4 @@ +use once_cell::sync::Lazy; use regex::Regex; use std::ops::Bound::{Excluded, Included, Unbounded}; use std::ops::RangeBounds; @@ -23,10 +24,10 @@ pub fn take_lines<R: RangeBounds<usize>>(s: &str, range: R) -> String { } } -lazy_static! { - static ref ANCHOR_START: Regex = Regex::new(r"ANCHOR:\s*(?P<anchor_name>[\w_-]+)").unwrap(); - static ref ANCHOR_END: Regex = Regex::new(r"ANCHOR_END:\s*(?P<anchor_name>[\w_-]+)").unwrap(); -} +static ANCHOR_START: Lazy<Regex> = + Lazy::new(|| Regex::new(r"ANCHOR:\s*(?P<anchor_name>[\w_-]+)").unwrap()); +static ANCHOR_END: Lazy<Regex> = + Lazy::new(|| Regex::new(r"ANCHOR_END:\s*(?P<anchor_name>[\w_-]+)").unwrap()); /// Take anchored lines from a string. /// Lines containing anchor are ignored. |