@@ -6,6 +6,7 @@ use std::fs;
6
6
use std:: io:: BufReader ;
7
7
use std:: iter:: FromIterator ;
8
8
use std:: path:: PathBuf ;
9
+ use std:: sync:: LazyLock ;
9
10
10
11
use anki_io:: create_file;
11
12
use anyhow:: Context ;
@@ -14,7 +15,6 @@ use clap::Args;
14
15
use fluent_syntax:: ast;
15
16
use fluent_syntax:: ast:: Resource ;
16
17
use fluent_syntax:: parser;
17
- use once_cell:: sync:: Lazy ;
18
18
use regex:: Regex ;
19
19
use walkdir:: DirEntry ;
20
20
use walkdir:: WalkDir ;
@@ -144,7 +144,8 @@ fn extract_nested_messages_and_terms(
144
144
ftl_roots : & [ impl AsRef < str > ] ,
145
145
used_ftls : & mut HashSet < String > ,
146
146
) {
147
- static REFERENCE : Lazy < Regex > = Lazy :: new ( || Regex :: new ( r"\{\s*-?([-0-9a-z]+)\s*\}" ) . unwrap ( ) ) ;
147
+ static REFERENCE : LazyLock < Regex > =
148
+ LazyLock :: new ( || Regex :: new ( r"\{\s*-?([-0-9a-z]+)\s*\}" ) . unwrap ( ) ) ;
148
149
for_files_with_ending ( ftl_roots, ".ftl" , |entry| {
149
150
let source = fs:: read_to_string ( entry. path ( ) ) . expect ( "file not readable" ) ;
150
151
for caps in REFERENCE . captures_iter ( & source) {
@@ -196,12 +197,12 @@ fn entry_use_check(used_ftls: &HashSet<String>) -> impl Fn(&ast::Entry<&str>) ->
196
197
}
197
198
198
199
fn extract_references_from_file ( refs : & mut HashSet < String > , entry : & DirEntry ) {
199
- static SNAKECASE_TR : Lazy < Regex > =
200
- Lazy :: new ( || Regex :: new ( r"\Wtr\s*\.([0-9a-z_]+)\W" ) . unwrap ( ) ) ;
201
- static CAMELCASE_TR : Lazy < Regex > =
202
- Lazy :: new ( || Regex :: new ( r"\Wtr2?\.([0-9A-Za-z_]+)\W" ) . unwrap ( ) ) ;
203
- static DESIGNER_STYLE_TR : Lazy < Regex > =
204
- Lazy :: new ( || Regex :: new ( r"<string>([0-9a-z_]+)</string>" ) . unwrap ( ) ) ;
200
+ static SNAKECASE_TR : LazyLock < Regex > =
201
+ LazyLock :: new ( || Regex :: new ( r"\Wtr\s*\.([0-9a-z_]+)\W" ) . unwrap ( ) ) ;
202
+ static CAMELCASE_TR : LazyLock < Regex > =
203
+ LazyLock :: new ( || Regex :: new ( r"\Wtr2?\.([0-9A-Za-z_]+)\W" ) . unwrap ( ) ) ;
204
+ static DESIGNER_STYLE_TR : LazyLock < Regex > =
205
+ LazyLock :: new ( || Regex :: new ( r"<string>([0-9a-z_]+)</string>" ) . unwrap ( ) ) ;
205
206
206
207
let file_name = entry. file_name ( ) . to_str ( ) . expect ( "non-unicode filename" ) ;
207
208
0 commit comments