Skip to content

Commit f6f7f9d

Browse files
authored
Merge pull request #47 from epage/w7
chore: Upgrade to Winnow 0.7
2 parents 32273c8 + 3a5150a commit f6f7f9d

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ pre-release-replacements = [
112112
]
113113

114114
[dependencies]
115-
winnow = "0.6.0"
115+
winnow = "0.7.0"
116116
itertools = "0.14"
117117

118118
[dev-dependencies]

src/quote.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use itertools::Itertools;
44
use winnow::combinator::{alt, preceded, repeat, terminated};
55
use winnow::prelude::*;
66
use winnow::token::{one_of, take_while};
7+
use winnow::Result;
78

89
#[derive(Debug)]
910
pub struct QuoteError;
@@ -20,12 +21,13 @@ pub fn sq_dequote_step<'i>(input: &mut &'i str) -> Result<Cow<'i, str>, QuoteErr
2021
sq_dequote.parse_next(input).map_err(|_e| QuoteError)
2122
}
2223

23-
pub fn sq_dequote<'i>(input: &mut &'i str) -> PResult<Cow<'i, str>, ()> {
24+
#[allow(clippy::result_unit_err)]
25+
pub fn sq_dequote<'i>(input: &mut &'i str) -> Result<Cow<'i, str>, ()> {
2426
// See git's quote.c's `sq_dequote_step`
2527
alt((sq_dequote_escaped, sq_dequote_no_escaped)).parse_next(input)
2628
}
2729

28-
fn sq_dequote_escaped<'i>(input: &mut &'i str) -> PResult<Cow<'i, str>, ()> {
30+
fn sq_dequote_escaped<'i>(input: &mut &'i str) -> Result<Cow<'i, str>, ()> {
2931
(
3032
sq_dequote_section,
3133
sq_dequote_trail,
@@ -40,22 +42,22 @@ fn sq_dequote_escaped<'i>(input: &mut &'i str) -> PResult<Cow<'i, str>, ()> {
4042
.parse_next(input)
4143
}
4244

43-
fn sq_dequote_no_escaped<'i>(input: &mut &'i str) -> PResult<Cow<'i, str>, ()> {
45+
fn sq_dequote_no_escaped<'i>(input: &mut &'i str) -> Result<Cow<'i, str>, ()> {
4446
sq_dequote_section.map(Cow::Borrowed).parse_next(input)
4547
}
4648

47-
fn sq_dequote_section<'i>(input: &mut &'i str) -> PResult<&'i str, ()> {
49+
fn sq_dequote_section<'i>(input: &mut &'i str) -> Result<&'i str, ()> {
4850
terminated(preceded('\'', take_while(0.., |c| c != '\'')), '\'').parse_next(input)
4951
}
5052

51-
fn sq_dequote_trail<'i>(input: &mut &'i str) -> PResult<[&'i str; 2], ()> {
53+
fn sq_dequote_trail<'i>(input: &mut &'i str) -> Result<[&'i str; 2], ()> {
5254
(escaped, sq_dequote_section)
5355
.map(|(e, s)| [e, s])
5456
.parse_next(input)
5557
}
5658

57-
fn escaped<'i>(input: &mut &'i str) -> PResult<&'i str, ()> {
58-
preceded('\\', one_of(['\'', '!']).recognize()).parse_next(input)
59+
fn escaped<'i>(input: &mut &'i str) -> Result<&'i str, ()> {
60+
preceded('\\', one_of(['\'', '!']).take()).parse_next(input)
5961
}
6062

6163
#[cfg(test)]

0 commit comments

Comments
 (0)