diff --git a/Cargo.lock b/Cargo.lock index b8f8884..570c623 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2057,9 +2057,9 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winnow" -version = "0.4.1" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae8970b36c66498d8ff1d66685dc86b91b29db0c7739899012f63a63814b4b28" +checksum = "6dd168d560b787538a8ab920d47c030a5c0d488b515dd20798d59ea279a5b1df" dependencies = [ "memchr", ] diff --git a/crates/typos/Cargo.toml b/crates/typos/Cargo.toml index c3b911c..9fd3392 100644 --- a/crates/typos/Cargo.toml +++ b/crates/typos/Cargo.toml @@ -14,7 +14,7 @@ include.workspace = true [dependencies] anyhow = "1.0" thiserror = "1.0" -winnow = "0.4.1" +winnow = "0.4.3" unicode-xid = "0.2.4" once_cell = "1.17.1" serde = { version = "1.0", features = ["derive"] } diff --git a/crates/typos/src/tokens.rs b/crates/typos/src/tokens.rs index e49e0cf..39f0edf 100644 --- a/crates/typos/src/tokens.rs +++ b/crates/typos/src/tokens.rs @@ -125,16 +125,14 @@ impl<'s> Iterator for Utf8Chunks<'s> { } mod parser { - use winnow::branch::*; - use winnow::bytes::*; use winnow::combinator::*; use winnow::prelude::*; - use winnow::sequence::*; use winnow::stream::AsBStr; use winnow::stream::AsChar; use winnow::stream::SliceLen; use winnow::stream::Stream; use winnow::stream::StreamIsPartial; + use winnow::token::*; pub(crate) fn next_identifier(input: T) -> IResult::Slice> where @@ -257,8 +255,8 @@ mod parser { preceded( '#', alt(( - terminated(take_while_m_n(3, 8, is_lower_hex_digit), peek(sep1)), - terminated(take_while_m_n(3, 8, is_upper_hex_digit), peek(sep1)), + terminated(take_while(3..=8, is_lower_hex_digit), peek(sep1)), + terminated(take_while(3..=8, is_upper_hex_digit), peek(sep1)), )), ) .parse_next(input) @@ -272,26 +270,26 @@ mod parser { { alt(( ( - take_while_m_n(8, 8, is_lower_hex_digit), + take_while(8, is_lower_hex_digit), '-', - take_while_m_n(4, 4, is_lower_hex_digit), + take_while(4, is_lower_hex_digit), '-', - take_while_m_n(4, 4, is_lower_hex_digit), + take_while(4, is_lower_hex_digit), '-', - take_while_m_n(4, 4, is_lower_hex_digit), + take_while(4, is_lower_hex_digit), '-', - take_while_m_n(12, 12, is_lower_hex_digit), + take_while(12, is_lower_hex_digit), ), ( - take_while_m_n(8, 8, is_upper_hex_digit), + take_while(8, is_upper_hex_digit), '-', - take_while_m_n(4, 4, is_upper_hex_digit), + take_while(4, is_upper_hex_digit), '-', - take_while_m_n(4, 4, is_upper_hex_digit), + take_while(4, is_upper_hex_digit), '-', - take_while_m_n(4, 4, is_upper_hex_digit), + take_while(4, is_upper_hex_digit), '-', - take_while_m_n(12, 12, is_upper_hex_digit), + take_while(12, is_upper_hex_digit), ), )) .recognize() @@ -314,10 +312,9 @@ mod parser { // or more. const IGNORE_HEX_MIN: usize = 32; - const IGNORE_HEX_MAX: usize = usize::MAX; alt(( - take_while_m_n(IGNORE_HEX_MIN, IGNORE_HEX_MAX, is_lower_hex_digit), - take_while_m_n(IGNORE_HEX_MIN, IGNORE_HEX_MAX, is_upper_hex_digit), + take_while(IGNORE_HEX_MIN.., is_lower_hex_digit), + take_while(IGNORE_HEX_MIN.., is_upper_hex_digit), )) .parse_next(input) } @@ -350,7 +347,7 @@ mod parser { } let (after, _) = - take_while_m_n(padding_len, padding_len, is_base64_padding).parse_next(padding)?; + take_while(padding_len..=padding_len, is_base64_padding).parse_next(padding)?; let after_offset = input.offset_to(&after); Ok(input.next_slice(after_offset)) @@ -439,12 +436,7 @@ mod parser { F: winnow::Parser::Slice, E>, E: winnow::error::ParseError, { - move |i: I| { - winnow::multi::many0(f.by_ref()) - .map(|()| ()) - .recognize() - .parse_next(i) - } + move |i: I| repeat0(f.by_ref()).map(|()| ()).recognize().parse_next(i) } #[inline] diff --git a/crates/varcon-core/Cargo.toml b/crates/varcon-core/Cargo.toml index 3bc7d75..783d634 100644 --- a/crates/varcon-core/Cargo.toml +++ b/crates/varcon-core/Cargo.toml @@ -16,7 +16,7 @@ parser = ["winnow"] flags = ["enumflags2"] [dependencies] -winnow = { version = "0.4.1", optional = true } +winnow = { version = "0.4.3", optional = true } enumflags2 = { version = "0.7", optional = true } [package.metadata.docs.rs]