@@ -6,6 +6,7 @@ use std::fs;
66use std:: io:: BufReader ;
77use std:: iter:: FromIterator ;
88use std:: path:: PathBuf ;
9+ use std:: sync:: LazyLock ;
910
1011use anki_io:: create_file;
1112use anyhow:: Context ;
@@ -14,7 +15,6 @@ use clap::Args;
1415use fluent_syntax:: ast;
1516use fluent_syntax:: ast:: Resource ;
1617use fluent_syntax:: parser;
17- use once_cell:: sync:: Lazy ;
1818use regex:: Regex ;
1919use walkdir:: DirEntry ;
2020use walkdir:: WalkDir ;
@@ -144,7 +144,8 @@ fn extract_nested_messages_and_terms(
144144 ftl_roots : & [ impl AsRef < str > ] ,
145145 used_ftls : & mut HashSet < String > ,
146146) {
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 ( ) ) ;
148149 for_files_with_ending ( ftl_roots, ".ftl" , |entry| {
149150 let source = fs:: read_to_string ( entry. path ( ) ) . expect ( "file not readable" ) ;
150151 for caps in REFERENCE . captures_iter ( & source) {
@@ -196,12 +197,12 @@ fn entry_use_check(used_ftls: &HashSet<String>) -> impl Fn(&ast::Entry<&str>) ->
196197}
197198
198199fn 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 ( ) ) ;
205206
206207 let file_name = entry. file_name ( ) . to_str ( ) . expect ( "non-unicode filename" ) ;
207208
0 commit comments