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
181 "home",181 "home",
182 "insta",182 "insta",
183 "log",183 "log",
184 "nom",
185 "pulldown-cmark",184 "pulldown-cmark",
186 "semver",185 "semver",
187 "time",186 "time",
188 "toml_edit",187 "toml_edit",
188 "winnow 0.3.6",
189]189]
190 190
191[[package]]191[[package]]
@@ -636,7 +636,7 @@ checksum = "4b3db1aca6f1a2607dd99beed5d99df831ac73eae5994ff301dae712928e2dac" · 444 unmodified lines
636dependencies = [636dependencies = [
637 "doc-comment",637 "doc-comment",
638 "unicase",638 "unicase",
639 "winnow",639 "winnow 0.5.0",
640]640]
641 641
642[[package]]642[[package]]
@@ -2452,7 +2452,7 @@ dependencies = [ · 1809 unmodified lines
2452 "serde",2452 "serde",
2453 "serde_spanned",2453 "serde_spanned",
2454 "toml_datetime",2454 "toml_datetime",
2455 "winnow",2455 "winnow 0.5.0",
2456]2456]
2457 2457
2458[[package]]2458[[package]]
@@ -2708,6 +2708,15 @@ version = "0.48.0" · 249 unmodified lines
2708source = "registry+https://github.com/rust-lang/crates.io-index"2708source = "registry+https://github.com/rust-lang/crates.io-index"
2709checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"2709checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
2710 2710
2711[[package]]
2712name = "winnow"
2713version = "0.3.6"
2714source = "registry+https://github.com/rust-lang/crates.io-index"
2715checksum = "23d020b441f92996c80d94ae9166e8501e59c7bb56121189dc9eab3bd8216966"
2716dependencies = [
2717 "memchr",
2718]
2719
2711[[package]]2720[[package]]
2712name = "winnow"2721name = "winnow"
2713version = "0.5.0"2722version = "0.5.0"
cargo-smart-release/Cargo.toml+1−1
@@ -34,7 +34,7 @@ toml_edit = "0.19.1" · 33 unmodified lines
34semver = "1.0.4"34semver = "1.0.4"
35crates-index = { version = "1.0.0", git = "https://github.com/Byron/rust-crates-index", branch = "replace-git2-with-gitoxide" }35crates-index = { version = "1.0.0", git = "https://github.com/Byron/rust-crates-index", branch = "replace-git2-with-gitoxide" }
36cargo_toml = "0.15.1"36cargo_toml = "0.15.1"
37nom = { version = "7", default-features = false, features = ["std"]}37winnow = "0.3.0"
38git-conventional = "0.12.0"38git-conventional = "0.12.0"
39time = "0.3.19"39time = "0.3.19"
40pulldown-cmark = "0.9.0"40pulldown-cmark = "0.9.0"
cargo-smart-release/src/changelog/parse.rs+5−5
@@ -6,15 +6,15 @@ use std::{ · 5 unmodified lines
6};6};
7 7
8use gix::bstr::ByteSlice;8use gix::bstr::ByteSlice;
9use nom::{9use pulldown_cmark::{CowStr, Event, HeadingLevel, OffsetIter, Tag};
10use winnow::{
10 branch::alt,11 branch::alt,
11 bytes::complete::{tag, tag_no_case, take_till, take_while, take_while_m_n},12 bytes::complete::{tag, tag_no_case, take_till, take_while, take_while_m_n},
12 combinator::{all_consuming, map, map_res, opt},13 combinator::{all_consuming, map, map_res, opt},
13 error::{FromExternalError, ParseError},14 error::{FromExternalError, ParseError},
14 sequence::{delimited, preceded, separated_pair, terminated, tuple},15 sequence::{delimited, preceded, separated_pair, terminated, tuple},
15 Finish, IResult,16 FinishIResult, IResult,
16};17};
17use pulldown_cmark::{CowStr, Event, HeadingLevel, OffsetIter, Tag};
18 18
19use crate::{19use crate::{
20 changelog,20 changelog,
@@ -467,7 +467,7 @@ impl<'a> TryFrom<&'a str> for Headline { · 446 unmodified lines
467 type Error = ();467 type Error = ();
468 468
469 fn try_from(value: &'a str) -> Result<Self, Self::Error> {469 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)
471 }471 }
472}472}
473 473
@@ -515,7 +515,7 @@ fn headline<'a, E: ParseError<&'a str> + FromExternalError<&'a str, ()>>(i: &'a · 41 unmodified lines
515 )),515 )),
516 greedy_whitespace,516 greedy_whitespace,
517 ),517 ),
518 |((hashes, (prefix, version)), date)| Headline {518 |((hashes, (prefix, version)), date): ((&str, (_, _)), _)| Headline {
519 level: hashes.len(),519 level: hashes.len(),
520 version_prefix: prefix.map_or_else(String::new, ToOwned::to_owned),520 version_prefix: prefix.map_or_else(String::new, ToOwned::to_owned),
521 version,521 version,