From cec8354e711137ce844f487c350adb505cdaa3d3 Mon Sep 17 00:00:00 2001 From: Dhruv Manilawala Date: Wed, 12 Jun 2024 11:23:03 +0530 Subject: [PATCH] Use the existing `ruff_python_trivia::is_python_whitespace` function --- crates/ruff_python_parser/src/lexer.rs | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/crates/ruff_python_parser/src/lexer.rs b/crates/ruff_python_parser/src/lexer.rs index 1dc686f5af76e5..5e6b5b3160633d 100644 --- a/crates/ruff_python_parser/src/lexer.rs +++ b/crates/ruff_python_parser/src/lexer.rs @@ -18,6 +18,7 @@ use ruff_python_ast::str_prefix::{ AnyStringPrefix, ByteStringPrefix, FStringPrefix, StringLiteralPrefix, }; use ruff_python_ast::{AnyStringFlags, Int, IpyEscapeKind, StringFlags}; +use ruff_python_trivia::is_python_whitespace; use ruff_text_size::{Ranged, TextLen, TextRange, TextSize}; use crate::error::FStringErrorType; @@ -1807,20 +1808,6 @@ fn is_identifier_continuation(c: char, identifier_is_ascii_only: &mut bool) -> b } } -/// Returns `true` for [whitespace](https://docs.python.org/3/reference/lexical_analysis.html#whitespace-between-tokens) -/// characters. -/// -/// This is the same as `ruff_python_trivia::is_python_whitespace` and is copied -/// here to avoid a circular dependency as `ruff_python_trivia` has a dev-dependency -/// on `ruff_python_lexer`. -const fn is_python_whitespace(c: char) -> bool { - matches!( - c, - // Space, tab, or form-feed - ' ' | '\t' | '\x0C' - ) -} - enum LexedText<'a> { Source { source: &'a str, range: TextRange }, Owned(String),