@@ -13,10 +13,10 @@ use std::fs::File;
1313use std:: io:: { self , BufRead , BufReader } ;
1414use std:: mem;
1515use std:: path:: Path ;
16+ use std:: sync:: OnceLock ;
1617
1718use super :: regex:: Regex ;
1819use crate :: parsing:: syntax_definition:: ContextId ;
19- use once_cell:: sync:: OnceCell ;
2020use serde_derive:: { Deserialize , Serialize } ;
2121
2222/// A syntax set holds multiple syntaxes that have been linked together.
@@ -34,8 +34,8 @@ pub struct SyntaxSet {
3434 /// Stores the syntax index for every path that was loaded
3535 path_syntaxes : Vec < ( String , usize ) > ,
3636
37- #[ serde( skip_serializing, skip_deserializing, default = "OnceCell ::new" ) ]
38- first_line_cache : OnceCell < FirstLineCache > ,
37+ #[ serde( skip_serializing, skip_deserializing, default = "OnceLock ::new" ) ]
38+ first_line_cache : OnceLock < FirstLineCache > ,
3939 /// Metadata, e.g. indent and commenting information.
4040 ///
4141 /// NOTE: if serializing, you should handle metadata manually; that is, you should serialize and
@@ -58,7 +58,7 @@ pub struct SyntaxReference {
5858 #[ serde( serialize_with = "ordered_map" ) ]
5959 pub variables : HashMap < String , String > ,
6060 #[ serde( skip) ]
61- pub ( crate ) lazy_contexts : OnceCell < LazyContexts > ,
61+ pub ( crate ) lazy_contexts : OnceLock < LazyContexts > ,
6262 pub ( crate ) serialized_lazy_contexts : Vec < u8 > ,
6363}
6464
@@ -114,7 +114,7 @@ impl Clone for SyntaxSet {
114114 syntaxes : self . syntaxes . clone ( ) ,
115115 path_syntaxes : self . path_syntaxes . clone ( ) ,
116116 // Will need to be re-initialized
117- first_line_cache : OnceCell :: new ( ) ,
117+ first_line_cache : OnceLock :: new ( ) ,
118118 #[ cfg( feature = "metadata" ) ]
119119 metadata : self . metadata . clone ( ) ,
120120 }
@@ -126,7 +126,7 @@ impl Default for SyntaxSet {
126126 SyntaxSet {
127127 syntaxes : Vec :: new ( ) ,
128128 path_syntaxes : Vec :: new ( ) ,
129- first_line_cache : OnceCell :: new ( ) ,
129+ first_line_cache : OnceLock :: new ( ) ,
130130 #[ cfg( feature = "metadata" ) ]
131131 metadata : Metadata :: default ( ) ,
132132 }
@@ -627,7 +627,7 @@ impl SyntaxSetBuilder {
627627 first_line_match,
628628 hidden,
629629 variables,
630- lazy_contexts : OnceCell :: new ( ) ,
630+ lazy_contexts : OnceLock :: new ( ) ,
631631 serialized_lazy_contexts : Vec :: new ( ) , // initialized in the last step
632632 } ;
633633 syntaxes. push ( syntax) ;
@@ -711,7 +711,7 @@ impl SyntaxSetBuilder {
711711 SyntaxSet {
712712 syntaxes,
713713 path_syntaxes,
714- first_line_cache : OnceCell :: new ( ) ,
714+ first_line_cache : OnceLock :: new ( ) ,
715715 #[ cfg( feature = "metadata" ) ]
716716 metadata,
717717 }
0 commit comments