We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b7d278f commit e02d16aCopy full SHA for e02d16a
src/tokenizer.rs
@@ -262,7 +262,7 @@ impl<'a> Tokenizer<'a> {
262
263
#[inline]
264
pub fn next(&mut self) -> Result<Token<'a>, ()> {
265
- next_token(self).ok_or(())
+ next_token(self)
266
}
267
268
@@ -401,9 +401,9 @@ pub struct SourceLocation {
401
402
403
404
-fn next_token<'a>(tokenizer: &mut Tokenizer<'a>) -> Option<Token<'a>> {
+fn next_token<'a>(tokenizer: &mut Tokenizer<'a>) -> Result<Token<'a>, ()> {
405
if tokenizer.is_eof() {
406
- return None
+ return Err(())
407
408
let c = tokenizer.next_byte_unchecked();
409
let token = match_byte! { c,
@@ -564,7 +564,7 @@ fn next_token<'a>(tokenizer: &mut Tokenizer<'a>) -> Option<Token<'a>> {
564
565
},
566
};
567
- Some(token)
+ Ok(token)
568
569
570
0 commit comments