Skip to content

Commit b0fe99f

Browse files
committed
Auto merge of #15669 - Veykril:simplify, r=Veykril
Simplify
2 parents d3cc3bc + 0dbde71 commit b0fe99f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

crates/syntax/src/lib.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ pub use smol_str::SmolStr;
7575
#[derive(Debug, PartialEq, Eq)]
7676
pub struct Parse<T> {
7777
green: GreenNode,
78-
errors: Arc<Vec<SyntaxError>>,
78+
errors: Arc<[SyntaxError]>,
7979
_ty: PhantomData<fn() -> T>,
8080
}
8181

@@ -87,7 +87,7 @@ impl<T> Clone for Parse<T> {
8787

8888
impl<T> Parse<T> {
8989
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 }
9191
}
9292

9393
pub fn syntax_node(&self) -> SyntaxNode {
@@ -107,7 +107,7 @@ impl<T: AstNode> Parse<T> {
107107
T::cast(self.syntax_node()).unwrap()
108108
}
109109

110-
pub fn ok(self) -> Result<T, Arc<Vec<SyntaxError>>> {
110+
pub fn ok(self) -> Result<T, Arc<[SyntaxError]>> {
111111
if self.errors.is_empty() {
112112
Ok(self.tree())
113113
} else {
@@ -144,7 +144,7 @@ impl Parse<SourceFile> {
144144
parsing::incremental_reparse(self.tree().syntax(), indel, self.errors.to_vec()).map(
145145
|(green_node, errors, _reparsed_range)| Parse {
146146
green: green_node,
147-
errors: Arc::new(errors),
147+
errors: errors.into(),
148148
_ty: PhantomData,
149149
},
150150
)
@@ -168,7 +168,7 @@ impl SourceFile {
168168
errors.extend(validation::validate(&root));
169169

170170
assert_eq!(root.kind(), SyntaxKind::SOURCE_FILE);
171-
Parse { green, errors: Arc::new(errors), _ty: PhantomData }
171+
Parse { green, errors: errors.into(), _ty: PhantomData }
172172
}
173173
}
174174

@@ -275,7 +275,7 @@ impl ast::TokenTree {
275275

276276
let (green, errors) = builder.finish_raw();
277277

278-
Parse { green, errors: Arc::new(errors), _ty: PhantomData }
278+
Parse { green, errors: errors.into(), _ty: PhantomData }
279279
}
280280
}
281281

0 commit comments

Comments
 (0)