@@ -75,7 +75,7 @@ pub use smol_str::SmolStr;
75
75
#[ derive( Debug , PartialEq , Eq ) ]
76
76
pub struct Parse < T > {
77
77
green : GreenNode ,
78
- errors : Arc < Vec < SyntaxError > > ,
78
+ errors : Arc < [ SyntaxError ] > ,
79
79
_ty : PhantomData < fn ( ) -> T > ,
80
80
}
81
81
@@ -87,7 +87,7 @@ impl<T> Clone for Parse<T> {
87
87
88
88
impl < T > Parse < T > {
89
89
fn new ( green : GreenNode , errors : Vec < SyntaxError > ) -> Parse < T > {
90
- Parse { green, errors : Arc :: new ( errors) , _ty : PhantomData }
90
+ Parse { green, errors : errors. into ( ) , _ty : PhantomData }
91
91
}
92
92
93
93
pub fn syntax_node ( & self ) -> SyntaxNode {
@@ -107,7 +107,7 @@ impl<T: AstNode> Parse<T> {
107
107
T :: cast ( self . syntax_node ( ) ) . unwrap ( )
108
108
}
109
109
110
- pub fn ok ( self ) -> Result < T , Arc < Vec < SyntaxError > > > {
110
+ pub fn ok ( self ) -> Result < T , Arc < [ SyntaxError ] > > {
111
111
if self . errors . is_empty ( ) {
112
112
Ok ( self . tree ( ) )
113
113
} else {
@@ -144,7 +144,7 @@ impl Parse<SourceFile> {
144
144
parsing:: incremental_reparse ( self . tree ( ) . syntax ( ) , indel, self . errors . to_vec ( ) ) . map (
145
145
|( green_node, errors, _reparsed_range) | Parse {
146
146
green : green_node,
147
- errors : Arc :: new ( errors) ,
147
+ errors : errors. into ( ) ,
148
148
_ty : PhantomData ,
149
149
} ,
150
150
)
@@ -168,7 +168,7 @@ impl SourceFile {
168
168
errors. extend ( validation:: validate ( & root) ) ;
169
169
170
170
assert_eq ! ( root. kind( ) , SyntaxKind :: SOURCE_FILE ) ;
171
- Parse { green, errors : Arc :: new ( errors) , _ty : PhantomData }
171
+ Parse { green, errors : errors. into ( ) , _ty : PhantomData }
172
172
}
173
173
}
174
174
@@ -275,7 +275,7 @@ impl ast::TokenTree {
275
275
276
276
let ( green, errors) = builder. finish_raw ( ) ;
277
277
278
- Parse { green, errors : Arc :: new ( errors) , _ty : PhantomData }
278
+ Parse { green, errors : errors. into ( ) , _ty : PhantomData }
279
279
}
280
280
}
281
281
0 commit comments