Skip to content

Commit 3faebcc

Browse files
authored
Merge pull request #621 from ltratt/pattern_matching_fix
Pass `LexerKind` by reference.
2 parents bbb0343 + a9555d2 commit 3faebcc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lrlex/src/lib/ctbuilder.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ where
248248
show_warnings: bool,
249249
header: Header<Location>,
250250
#[cfg(test)]
251-
inspect_lexerkind_cb: Option<Box<dyn Fn(LexerKind) -> Result<(), Box<dyn Error>>>>,
251+
inspect_lexerkind_cb: Option<Box<dyn Fn(&LexerKind) -> Result<(), Box<dyn Error>>>>,
252252
}
253253

254254
impl CTLexerBuilder<'_, DefaultLexerTypes<u32>> {
@@ -509,7 +509,7 @@ where
509509
};
510510
#[cfg(test)]
511511
if let Some(inspect_lexerkind_cb) = self.inspect_lexerkind_cb {
512-
inspect_lexerkind_cb(lexerkind)?
512+
inspect_lexerkind_cb(&lexerkind)?
513513
}
514514
let (lexerdef, lex_flags): (LRNonStreamingLexerDef<LexerTypesT>, LexFlags) =
515515
match lexerkind {
@@ -1211,7 +1211,7 @@ where
12111211
#[cfg(test)]
12121212
pub fn inspect_lexerkind(
12131213
mut self,
1214-
cb: Box<dyn Fn(LexerKind) -> Result<(), Box<dyn Error>>>,
1214+
cb: Box<dyn Fn(&LexerKind) -> Result<(), Box<dyn Error>>>,
12151215
) -> Self {
12161216
self.inspect_lexerkind_cb = Some(cb);
12171217
self
@@ -1481,7 +1481,7 @@ mod test {
14811481
.output_path(format!("{}.rs", lex_path.clone()))
14821482
.lexer_path(lex_path.clone())
14831483
.inspect_lexerkind(Box::new(move |lexerkind| {
1484-
assert!(matches!(lexerkind, LexerKind::LRNonStreamingLexer));
1484+
assert!(matches!(lexerkind, &LexerKind::LRNonStreamingLexer));
14851485
Ok(())
14861486
}))
14871487
.build()

0 commit comments

Comments
 (0)