4
4
5
5
use super :: pattern:: Pattern ;
6
6
use super :: { Element , Rules } ;
7
- use lazy_static:: lazy_static;
8
7
use regex:: Regex ;
8
+ use std:: sync:: LazyLock ;
9
9
10
10
fn re ( regex : & str ) -> Pattern {
11
11
Pattern :: regex ( Regex :: new ( regex) . unwrap ( ) )
@@ -19,22 +19,20 @@ fn src() -> Pattern {
19
19
re ( "^(http:|https:)" ) | !re ( "^[^/]+[[:space:]]*:" )
20
20
}
21
21
22
- lazy_static ! {
23
- /// Basic rules. Allows a variety of markup including formatting elements, links, and lists.
24
- pub static ref BASIC : Rules = basic( ) ;
22
+ /// Basic rules. Allows a variety of markup including formatting elements, links, and lists.
23
+ pub static BASIC : LazyLock < Rules > = LazyLock :: new ( || basic ( ) ) ;
25
24
26
- /// Default rules. Removes all tags.
27
- pub static ref DEFAULT : Rules = default ( ) ;
25
+ /// Default rules. Removes all tags.
26
+ pub static DEFAULT : LazyLock < Rules > = LazyLock :: new ( || default ( ) ) ;
28
27
29
- /// Relaxed rules. Allows an even wider variety of markup, including images and tables
30
- pub static ref RELAXED : Rules = relaxed( ) ;
28
+ /// Relaxed rules. Allows an even wider variety of markup, including images and tables
29
+ pub static RELAXED : LazyLock < Rules > = LazyLock :: new ( || relaxed ( ) ) ;
31
30
32
- /// Restricted rules. Allows only very simple inline markup. No links, images, or block elements.
33
- pub static ref RESTRICTED : Rules = restricted( ) ;
31
+ /// Restricted rules. Allows only very simple inline markup. No links, images, or block elements.
32
+ pub static RESTRICTED : LazyLock < Rules > = LazyLock :: new ( || restricted ( ) ) ;
34
33
35
- /// Rules for document from untrusted sources. Removes all tags but text emphasizing and links.
36
- pub static ref UNTRUSTED : Rules = untrusted( ) ;
37
- }
34
+ /// Rules for document from untrusted sources. Removes all tags but text emphasizing and links.
35
+ pub static UNTRUSTED : LazyLock < Rules > = LazyLock :: new ( || untrusted ( ) ) ;
38
36
39
37
fn basic ( ) -> Rules {
40
38
Rules :: new ( )
0 commit comments