mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 18:58:04 +00:00
[red-knot] Ignore surrounding whitespace when looking for <!-- snapshot-diagnostics -->
directives in mdtests (#16380)
This commit is contained in:
parent
d56d241317
commit
040071bbc5
2 changed files with 54 additions and 15 deletions
|
@ -95,7 +95,22 @@ impl<'a> Cursor<'a> {
|
|||
/// Eats the next two characters if they are `c1` and `c2`. Does not
|
||||
/// consume any input otherwise, even if the first character matches.
|
||||
pub fn eat_char2(&mut self, c1: char, c2: char) -> bool {
|
||||
if self.first() == c1 && self.second() == c2 {
|
||||
let mut chars = self.chars.clone();
|
||||
if chars.next() == Some(c1) && chars.next() == Some(c2) {
|
||||
self.bump();
|
||||
self.bump();
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
/// Eats the next three characters if they are `c1`, `c2` and `c3`
|
||||
/// Does not consume any input otherwise, even if the first character matches.
|
||||
pub fn eat_char3(&mut self, c1: char, c2: char, c3: char) -> bool {
|
||||
let mut chars = self.chars.clone();
|
||||
if chars.next() == Some(c1) && chars.next() == Some(c2) && chars.next() == Some(c3) {
|
||||
self.bump();
|
||||
self.bump();
|
||||
self.bump();
|
||||
true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue