diff options
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/parse/lexer/mod.rs | 5 | ||||
| -rw-r--r-- | src/libsyntax/util/parser_testing.rs | 3 |
2 files changed, 2 insertions, 6 deletions
diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index 1402b7888dd..3e61aaff3c9 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -1592,10 +1592,7 @@ impl<'a> StringReader<'a> { } pub fn is_whitespace(c: Option<char>) -> bool { - match c.unwrap_or('\x00') { // None can be null for now... it's not whitespace - ' ' | '\n' | '\t' | '\r' => true, - _ => false, - } + c.map_or(false, char::is_whitespace) } fn in_range(c: Option<char>, lo: char, hi: char) -> bool { diff --git a/src/libsyntax/util/parser_testing.rs b/src/libsyntax/util/parser_testing.rs index 454b925a494..74ff42b5db9 100644 --- a/src/libsyntax/util/parser_testing.rs +++ b/src/libsyntax/util/parser_testing.rs @@ -140,9 +140,8 @@ fn scan_for_non_ws_or_end(a : &str, idx: usize) -> usize { i } -/// Copied from lexer. pub fn is_whitespace(c: char) -> bool { - return c == ' ' || c == '\t' || c == '\r' || c == '\n'; + c.is_whitespace() } #[cfg(test)] |
