diff --git a/Cargo.lock b/Cargo.lock index ae5fea1d26b..d6964f71de0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1267,7 +1267,7 @@ dependencies = [ "pretty_assertions", "serde", "thiserror", - "winnow 0.3.6", + "winnow 0.4.9", ] [[package]] @@ -1858,7 +1858,7 @@ dependencies = [ "serde", "smallvec", "thiserror", - "winnow 0.3.6", + "winnow 0.4.9", ] [[package]] @@ -2097,7 +2097,7 @@ dependencies = [ "serde", "tempfile", "thiserror", - "winnow 0.3.6", + "winnow 0.4.9", ] [[package]] @@ -2245,7 +2245,7 @@ dependencies = [ "parking_lot", "tar", "tempfile", - "winnow 0.3.6", + "winnow 0.4.9", "xz2", ] @@ -4753,9 +4753,9 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winnow" -version = "0.3.6" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d020b441f92996c80d94ae9166e8501e59c7bb56121189dc9eab3bd8216966" +checksum = "81a2094c43cc94775293eaa0e499fbc30048a6d824ac82c0351a8c0bf9112529" dependencies = [ "memchr", ] diff --git a/gix-actor/Cargo.toml b/gix-actor/Cargo.toml index f2703b2cab0..340fe809462 100644 --- a/gix-actor/Cargo.toml +++ b/gix-actor/Cargo.toml @@ -23,7 +23,7 @@ gix-date = { version = "^0.7.1", path = "../gix-date" } thiserror = "1.0.38" btoi = "0.4.2" bstr = { version = "1.3.0", default-features = false, features = ["std", "unicode"]} -winnow = "0.3" +winnow = "0.4" itoa = "1.0.1" serde = { version = "1.0.114", optional = true, default-features = false, features = ["derive"]} diff --git a/gix-actor/src/signature/decode.rs b/gix-actor/src/signature/decode.rs index cb0f5b40cf9..acbe58b1530 100644 --- a/gix-actor/src/signature/decode.rs +++ b/gix-actor/src/signature/decode.rs @@ -31,7 +31,7 @@ pub(crate) mod function { .and_then(|(i, v)| { btoi::(v) .map(|v| (i, v)) - .map_err(|_| winnow::error::ErrMode::from_error_kind(i, winnow::error::ErrorKind::MapRes)) + .map_err(|_| winnow::error::ErrMode::from_error_kind(i, winnow::error::ErrorKind::Verify)) }) }) .context(""), @@ -46,7 +46,7 @@ pub(crate) mod function { .and_then(|(i, v)| { btoi::(v) .map(|v| (i, v)) - .map_err(|_| winnow::error::ErrMode::from_error_kind(i, winnow::error::ErrorKind::MapRes)) + .map_err(|_| winnow::error::ErrMode::from_error_kind(i, winnow::error::ErrorKind::Verify)) }) }) .context("HH"), @@ -56,7 +56,7 @@ pub(crate) mod function { .and_then(|(i, v)| { btoi::(v) .map(|v| (i, v)) - .map_err(|_| winnow::error::ErrMode::from_error_kind(i, winnow::error::ErrorKind::MapRes)) + .map_err(|_| winnow::error::ErrMode::from_error_kind(i, winnow::error::ErrorKind::Verify)) }) }) .context("MM"), @@ -188,7 +188,7 @@ mod tests { .map_err(to_bstr_err) .expect_err("parse fails as > is missing") .to_string(), - "Parse error:\nTakeUntil at: 12345 -1215\nin section '', at: 12345 -1215\nin section ' <>', at: hello < 12345 -1215\nin section ' <> <+|->', at: hello < 12345 -1215\n" + "Parse error:\nSlice at: 12345 -1215\nin section '', at: 12345 -1215\nin section ' <>', at: hello < 12345 -1215\nin section ' <> <+|->', at: hello < 12345 -1215\n" ); } @@ -199,7 +199,7 @@ mod tests { .map_err(to_bstr_err) .expect_err("parse fails as > is missing") .to_string(), - "Parse error:\nMapRes at: -1215\nin section '', at: abc -1215\nin section ' <> <+|->', at: hello <> abc -1215\n" + "Parse error:\nVerify at: -1215\nin section '', at: abc -1215\nin section ' <> <+|->', at: hello <> abc -1215\n" ); } } diff --git a/gix-object/Cargo.toml b/gix-object/Cargo.toml index 730a78c4891..699ac1c2f64 100644 --- a/gix-object/Cargo.toml +++ b/gix-object/Cargo.toml @@ -33,7 +33,7 @@ itoa = "1.0.1" thiserror = "1.0.34" hex = "0.4.2" bstr = { version = "1.3.0", default-features = false, features = ["std", "unicode"] } -winnow = "0.3" +winnow = "0.4" smallvec = { version = "1.4.0", features = ["write"] } serde = { version = "1.0.114", optional = true, default-features = false, features = ["derive"]} diff --git a/gix-object/src/tag/decode.rs b/gix-object/src/tag/decode.rs index 0372c66d147..6817e45a8e9 100644 --- a/gix-object/src/tag/decode.rs +++ b/gix-object/src/tag/decode.rs @@ -19,7 +19,7 @@ pub fn git_tag<'a, E: ParseError<&'a [u8]> + ContextError<&'a [u8]>>(i: &'a [u8] .context("type ") .parse_next(i)?; let kind = crate::Kind::from_bytes(kind) - .map_err(|_| winnow::error::ErrMode::from_error_kind(i, winnow::error::ErrorKind::MapRes))?; + .map_err(|_| winnow::error::ErrMode::from_error_kind(i, winnow::error::ErrorKind::Verify))?; let (i, tag_version) = (|i| parse::header_field(i, b"tag", take_while1(|b| b != NL[0]))) .context("tag ") diff --git a/gix-object/src/tag/ref_iter.rs b/gix-object/src/tag/ref_iter.rs index 10bcc87495f..efa6df00554 100644 --- a/gix-object/src/tag/ref_iter.rs +++ b/gix-object/src/tag/ref_iter.rs @@ -79,7 +79,7 @@ impl<'a> TagRefIter<'a> { .context("type ") .parse_next(i)?; let kind = Kind::from_bytes(kind) - .map_err(|_| winnow::error::ErrMode::from_error_kind(i, winnow::error::ErrorKind::MapRes))?; + .map_err(|_| winnow::error::ErrMode::from_error_kind(i, winnow::error::ErrorKind::Verify))?; *state = Name; (i, Token::TargetKind(kind)) } diff --git a/gix-object/src/tree/ref_iter.rs b/gix-object/src/tree/ref_iter.rs index 6775a41ad09..90bb9d54517 100644 --- a/gix-object/src/tree/ref_iter.rs +++ b/gix-object/src/tree/ref_iter.rs @@ -71,7 +71,7 @@ impl<'a> Iterator for TreeRefIter<'a> { #[allow(clippy::unit_arg)] Some(Err(winnow::error::ErrMode::from_error_kind( &[] as &[u8], - winnow::error::ErrorKind::MapRes, + winnow::error::ErrorKind::Verify, ) .into())) } @@ -163,7 +163,7 @@ mod decode { pub fn entry<'a, E: ParseError<&'a [u8]>>(i: &'a [u8]) -> IResult<&[u8], EntryRef<'_>, E> { let (i, mode) = terminated(take_while_m_n(5, 6, AsChar::is_dec_digit), SPACE).parse_next(i)?; let mode = tree::EntryMode::try_from(mode) - .map_err(|invalid| winnow::error::ErrMode::from_error_kind(invalid, winnow::error::ErrorKind::MapRes))?; + .map_err(|invalid| winnow::error::ErrMode::from_error_kind(invalid, winnow::error::ErrorKind::Verify))?; let (i, filename) = terminated(take_while1(|b| b != NULL[0]), NULL).parse_next(i)?; let (i, oid) = take(20u8).parse_next(i)?; // TODO: make this compatible with other hash lengths diff --git a/gix-ref/Cargo.toml b/gix-ref/Cargo.toml index 7dc09d41b46..681d46e0a0a 100644 --- a/gix-ref/Cargo.toml +++ b/gix-ref/Cargo.toml @@ -31,7 +31,7 @@ gix-lock = { version = "^7.0.0", path = "../gix-lock" } gix-tempfile = { version = "^7.0.0", default-features = false, path = "../gix-tempfile" } thiserror = "1.0.34" -winnow = "0.3" +winnow = "0.4" serde = { version = "1.0.114", optional = true, default-features = false, features = ["derive"]} # packed refs diff --git a/gix-ref/src/store/file/log/line.rs b/gix-ref/src/store/file/log/line.rs index 38805ac3ebb..fb82f6587cf 100644 --- a/gix-ref/src/store/file/log/line.rs +++ b/gix-ref/src/store/file/log/line.rs @@ -148,7 +148,7 @@ pub mod decode { if let Some(first) = message.first() { if !first.is_ascii_whitespace() { return Err( - winnow::error::ErrMode::from_error_kind(i, winnow::error::ErrorKind::MapRes).map(|err: E| { + winnow::error::ErrMode::from_error_kind(i, winnow::error::ErrorKind::Verify).map(|err: E| { err.add_context(i, "log message must be separated from signature with whitespace") }), ); diff --git a/tests/tools/Cargo.toml b/tests/tools/Cargo.toml index 3fea57a4945..5bb76a23a71 100644 --- a/tests/tools/Cargo.toml +++ b/tests/tools/Cargo.toml @@ -21,7 +21,7 @@ gix-worktree = "0.17.0" gix-fs = { version = "^0.4.1", path = "../../gix-fs" } gix-tempfile = { version = "^7.0.0", default-features = false, features = ["signals"], path = "../../gix-tempfile" } -winnow = "0.3" +winnow = "0.4" fastrand = "2.0.0" bstr = { version = "1.5.0", default-features = false } crc = "3.0.0"