Skip to content

Commit 781f086

Browse files
committed
Remove allocation for "expected multiple" error.
1 parent 645353d commit 781f086

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

crates/wac-parser/src/ast.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl fmt::Display for Found {
3232
}
3333

3434
struct Expected<'a> {
35-
expected: &'a Vec<Token>,
35+
expected: &'a [Token],
3636
more: bool,
3737
}
3838

@@ -95,7 +95,7 @@ pub enum Error<'a> {
9595
#[error("expected either {expected}, found {found}", expected = Expected { expected, more: *.more }, found = Found(*.found))]
9696
ExpectedMultiple {
9797
/// The tokens that were expected.
98-
expected: Vec<Token>,
98+
expected: SmallVec<[Token; 5]>,
9999
/// Whether or not more tokens were expected.
100100
more: bool,
101101
/// The found token.
@@ -240,7 +240,7 @@ impl<'a> Lookahead<'a> {
240240
span,
241241
},
242242
_ => Error::ExpectedMultiple {
243-
expected: self.attempts.into_vec(),
243+
expected: self.attempts,
244244
more,
245245
found,
246246
span,

0 commit comments

Comments
 (0)