From 87b68b79f831f37ebc5cde7817e079e4bff303ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hozda?= Date: Mon, 2 Oct 2017 08:33:47 +0200 Subject: [PATCH] check if a char is whitespace instead of explicitly checking against a few chars, ignore Cargo.lock --- .gitignore | 1 + src/parser.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 2f7896d1..2c96eb1b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ target/ +Cargo.lock diff --git a/src/parser.rs b/src/parser.rs index 822d1fd7..5293579a 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -463,7 +463,7 @@ impl<'a> Iterator for TokenIterator<'a> { } } } - ' ' | '\n' | '\r' => (), + _x if _x.is_whitespace() => (), _ => return Some(Token::LexErr(LexError::UnexpectedChar)), } }