History

refactor(release): Switch from nom to winnow 0.3

Ed Page committed 3 years ago

Commit 8fe96071 parent 146c1493 files · +18 −9Browse files

Unified · Split

3 files
  1. cargo-smart-release/Cargo.lock +12 −3
  2. cargo-smart-release/Cargo.toml +1 −1
  3. cargo-smart-release/src/changelog/parse.rs +5 −5
cargo-smart-release/Cargo.lock+12−3
@@ -181,11 +181,11 @@ dependencies = [ · 180 unmodified lines
181181 "home",
182182 "insta",
183183 "log",
184− "nom",
185184 "pulldown-cmark",
186185 "semver",
187186 "time",
188187 "toml_edit",
188+ "winnow 0.3.6",
189189 ]
190190
191191 [[package]]
@@ -636,7 +636,7 @@ checksum = "4b3db1aca6f1a2607dd99beed5d99df831ac73eae5994ff301dae712928e2dac" · 444 unmodified lines
636636 dependencies = [
637637 "doc-comment",
638638 "unicase",
639− "winnow",
639+ "winnow 0.5.0",
640640 ]
641641
642642 [[package]]
@@ -2452,7 +2452,7 @@ dependencies = [ · 1809 unmodified lines
24522452 "serde",
24532453 "serde_spanned",
24542454 "toml_datetime",
2455− "winnow",
2455+ "winnow 0.5.0",
24562456 ]
24572457
24582458 [[package]]
@@ -2708,6 +2708,15 @@ version = "0.48.0" · 249 unmodified lines
27082708 source = "registry+https://github.com/rust-lang/crates.io-index"
27092709 checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
27102710
2711+[[package]]
2712+name = "winnow"
2713+version = "0.3.6"
2714+source = "registry+https://github.com/rust-lang/crates.io-index"
2715+checksum = "23d020b441f92996c80d94ae9166e8501e59c7bb56121189dc9eab3bd8216966"
2716+dependencies = [
2717+ "memchr",
2718+]
2719+
27112720 [[package]]
27122721 name = "winnow"
27132722 version = "0.5.0"
cargo-smart-release/Cargo.toml+1−1
@@ -34,7 +34,7 @@ toml_edit = "0.19.1" · 33 unmodified lines
3434 semver = "1.0.4"
3535 crates-index = { version = "1.0.0", git = "https://github.com/Byron/rust-crates-index", branch = "replace-git2-with-gitoxide" }
3636 cargo_toml = "0.15.1"
37−nom = { version = "7", default-features = false, features = ["std"]}
37+winnow = "0.3.0"
3838 git-conventional = "0.12.0"
3939 time = "0.3.19"
4040 pulldown-cmark = "0.9.0"
cargo-smart-release/src/changelog/parse.rs+5−5
@@ -6,15 +6,15 @@ use std::{ · 5 unmodified lines
66 };
77
88 use gix::bstr::ByteSlice;
9−use nom::{
9+use pulldown_cmark::{CowStr, Event, HeadingLevel, OffsetIter, Tag};
10+use winnow::{
1011 branch::alt,
1112 bytes::complete::{tag, tag_no_case, take_till, take_while, take_while_m_n},
1213 combinator::{all_consuming, map, map_res, opt},
1314 error::{FromExternalError, ParseError},
1415 sequence::{delimited, preceded, separated_pair, terminated, tuple},
15− Finish, IResult,
16+ FinishIResult, IResult,
1617 };
17−use pulldown_cmark::{CowStr, Event, HeadingLevel, OffsetIter, Tag};
1818
1919 use crate::{
2020 changelog,
@@ -467,7 +467,7 @@ impl<'a> TryFrom<&'a str> for Headline { · 446 unmodified lines
467467 type Error = ();
468468
469469 fn try_from(value: &'a str) -> Result<Self, Self::Error> {
470− all_consuming(headline::<()>)(value).finish().map(|(_, h)| h)
470+ all_consuming(headline::<()>)(value).finish_err().map(|(_, h)| h)
471471 }
472472 }
473473
@@ -515,7 +515,7 @@ fn headline<'a, E: ParseError<&'a str> + FromExternalError<&'a str, ()>>(i: &'a · 41 unmodified lines
515515 )),
516516 greedy_whitespace,
517517 ),
518− |((hashes, (prefix, version)), date)| Headline {
518+ |((hashes, (prefix, version)), date): ((&str, (_, _)), _)| Headline {
519519 level: hashes.len(),
520520 version_prefix: prefix.map_or_else(String::new, ToOwned::to_owned),
521521 version,