Skip to content

Commit d48bb11

Browse files
committed
just allow arbitrary whitespace it's not a big deal
1 parent 6b5d25b commit d48bb11

1 file changed

Lines changed: 2 additions & 11 deletions

File tree

crates/ruff_linter/src/noqa.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ impl<'a> NoqaLexer<'a> {
519519

520520
fn lex_code(&mut self) -> Result<(), LexicalError> {
521521
self.cursor.start_token();
522-
self.eat_ascii_whitespace();
522+
self.eat_whitespace();
523523

524524
// Ex) # noqa: F401, ,F841
525525
// ^^^^
@@ -568,10 +568,7 @@ impl<'a> NoqaLexer<'a> {
568568
false
569569
}
570570

571-
// Whitespace could be a delimiter or the end of the `noqa`.
572-
// If it's the end, then non-ascii whitespace is allowed
573-
// Ex) `# noqa: RUF100\tRUF200` has a valid delimiter
574-
// Ex) `# noqa: RUF100\u{00A0}RUF200` will not read `RUF200`
571+
// Whitespace is an allowed delimiter or the end of the `noqa`.
575572
c if c.is_whitespace() => false,
576573

577574
// e.g. #noqa:F401F842
@@ -621,12 +618,6 @@ impl<'a> NoqaLexer<'a> {
621618
self.cursor.eat_while(char::is_whitespace);
622619
}
623620

624-
/// Consume ASCII whitespace
625-
#[inline]
626-
fn eat_ascii_whitespace(&mut self) {
627-
self.cursor.eat_while(|c| c.is_ascii_whitespace());
628-
}
629-
630621
/// Current token range relative to offset
631622
#[inline]
632623
fn token_range(&self) -> TextRange {

0 commit comments

Comments
 (0)