mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-23 13:05:06 +00:00
Move Python whitespace utilities into new ruff_python_whitespace
crate (#4993)
## Summary `ruff_newlines` becomes `ruff_python_whitespace`, and includes the existing "universal newline" handlers alongside the Python whitespace-specific utilities.
This commit is contained in:
parent
e86f12a1ec
commit
1d756dc3a7
57 changed files with 153 additions and 140 deletions
|
@ -1,10 +1,10 @@
|
|||
use crate::comments::visitor::{CommentPlacement, DecoratedComment};
|
||||
use crate::comments::CommentTextPosition;
|
||||
use crate::trivia::{SimpleTokenizer, TokenKind};
|
||||
use ruff_newlines::StrExt;
|
||||
use ruff_python_ast::node::AnyNodeRef;
|
||||
use ruff_python_ast::source_code::Locator;
|
||||
use ruff_python_ast::whitespace;
|
||||
use ruff_python_whitespace::UniversalNewlines;
|
||||
use ruff_text_size::{TextRange, TextSize};
|
||||
use rustpython_parser::ast::Ranged;
|
||||
use std::cmp::Ordering;
|
||||
|
|
|
@ -9,7 +9,7 @@ use ruff_python_ast::source_code::{CommentRanges, Locator};
|
|||
// pre-order.
|
||||
#[allow(clippy::wildcard_imports)]
|
||||
use ruff_python_ast::visitor::preorder::*;
|
||||
use ruff_python_ast::whitespace::is_python_whitespace;
|
||||
use ruff_python_whitespace::is_python_whitespace;
|
||||
use ruff_text_size::TextRange;
|
||||
use std::iter::Peekable;
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
use ruff_python_ast::whitespace::is_python_whitespace;
|
||||
use ruff_text_size::{TextLen, TextRange, TextSize};
|
||||
use std::str::Chars;
|
||||
|
||||
use ruff_text_size::{TextLen, TextRange, TextSize};
|
||||
|
||||
use ruff_python_whitespace::is_python_whitespace;
|
||||
|
||||
/// Searches for the first non-trivia character in `range`.
|
||||
///
|
||||
/// The search skips over any whitespace and comments.
|
||||
|
@ -528,10 +530,11 @@ impl<'a> Cursor<'a> {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::trivia::{lines_after, lines_before, SimpleTokenizer, Token};
|
||||
use insta::assert_debug_snapshot;
|
||||
use ruff_text_size::{TextLen, TextRange, TextSize};
|
||||
|
||||
use crate::trivia::{lines_after, lines_before, SimpleTokenizer, Token};
|
||||
|
||||
struct TokenizationTestCase {
|
||||
source: &'static str,
|
||||
range: TextRange,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue