Skip to content

Commit f0cbf81

Browse files
committed
Resolve 0.4 not-quite deprecations
1 parent 9ed7df0 commit f0cbf81

File tree

15 files changed

+65
-65
lines changed

15 files changed

+65
-65
lines changed

gix-actor/src/identity.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ impl<'a> IdentityRef<'a> {
66
/// Deserialize an identity from the given `data`.
77
pub fn from_bytes<E>(data: &'a [u8]) -> Result<Self, winnow::error::ErrMode<E>>
88
where
9-
E: winnow::error::ParseError<&'a [u8]> + winnow::error::ContextError<&'a [u8]>,
9+
E: winnow::error::ParserError<&'a [u8]> + winnow::error::AddContext<&'a [u8]>,
1010
{
1111
decode::identity(data).map(|(_, t)| t)
1212
}

gix-actor/src/signature/decode.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ pub(crate) mod function {
44
use gix_date::{time::Sign, OffsetInSeconds, SecondsSinceUnixEpoch, Time};
55
use std::cell::RefCell;
66
use winnow::{
7-
branch::alt,
8-
bytes::{take, take_until0, take_while},
7+
combinator::alt,
98
combinator::repeat,
10-
error::{ContextError, ParseError},
9+
combinator::terminated,
10+
error::{AddContext, ParserError},
1111
prelude::*,
12-
sequence::terminated,
1312
stream::AsChar,
13+
token::{take, take_until0, take_while},
1414
};
1515

1616
use crate::{IdentityRef, SignatureRef};
1717

1818
const SPACE: &[u8] = b" ";
1919

2020
/// Parse a signature from the bytes input `i` using `nom`.
21-
pub fn decode<'a, E: ParseError<&'a [u8]> + ContextError<&'a [u8]>>(
21+
pub fn decode<'a, E: ParserError<&'a [u8]> + AddContext<&'a [u8]>>(
2222
i: &'a [u8],
2323
) -> IResult<&'a [u8], SignatureRef<'a>, E> {
2424
let tzsign = RefCell::new(b'-'); // TODO: there should be no need for this.
@@ -82,7 +82,7 @@ pub(crate) mod function {
8282
}
8383

8484
/// Parse an identity from the bytes input `i` (like `name <email>`) using `nom`.
85-
pub fn identity<'a, E: ParseError<&'a [u8]> + ContextError<&'a [u8]>>(
85+
pub fn identity<'a, E: ParserError<&'a [u8]> + AddContext<&'a [u8]>>(
8686
i: &'a [u8],
8787
) -> IResult<&'a [u8], IdentityRef<'a>, E> {
8888
let (i, (name, email)) = (

gix-actor/src/signature/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ mod _ref {
77
/// Deserialize a signature from the given `data`.
88
pub fn from_bytes<E>(data: &'a [u8]) -> Result<SignatureRef<'a>, winnow::error::ErrMode<E>>
99
where
10-
E: winnow::error::ParseError<&'a [u8]> + winnow::error::ContextError<&'a [u8]>,
10+
E: winnow::error::ParserError<&'a [u8]> + winnow::error::AddContext<&'a [u8]>,
1111
{
1212
decode(data).map(|(_, t)| t)
1313
}

gix-object/src/commit/decode.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@ use std::borrow::Cow;
22

33
use smallvec::SmallVec;
44
use winnow::{
5-
branch::alt,
6-
bytes::{tag, take_till1},
5+
combinator::alt,
76
combinator::repeat,
7+
combinator::terminated,
88
combinator::{eof, opt},
9-
error::{ContextError, ParseError},
9+
error::{AddContext, ParserError},
1010
prelude::*,
11-
sequence::terminated,
11+
token::{tag, take_till1},
1212
};
1313

1414
use crate::{parse, parse::NL, BStr, ByteSlice, CommitRef};
1515

16-
pub fn message<'a, E: ParseError<&'a [u8]> + ContextError<&'a [u8]>>(i: &'a [u8]) -> IResult<&'a [u8], &'a BStr, E> {
16+
pub fn message<'a, E: ParserError<&'a [u8]> + AddContext<&'a [u8]>>(i: &'a [u8]) -> IResult<&'a [u8], &'a BStr, E> {
1717
if i.is_empty() {
1818
// newline + [message]
1919
return Err(
@@ -27,9 +27,7 @@ pub fn message<'a, E: ParseError<&'a [u8]> + ContextError<&'a [u8]>>(i: &'a [u8]
2727
Ok((&[], i.as_bstr()))
2828
}
2929

30-
pub fn commit<'a, E: ParseError<&'a [u8]> + ContextError<&'a [u8]>>(
31-
i: &'a [u8],
32-
) -> IResult<&'a [u8], CommitRef<'_>, E> {
30+
pub fn commit<'a, E: ParserError<&'a [u8]> + AddContext<&'a [u8]>>(i: &'a [u8]) -> IResult<&'a [u8], CommitRef<'_>, E> {
3331
let (i, tree) = (|i| parse::header_field(i, b"tree", parse::hex_hash))
3432
.context("tree <40 lowercase hex char>")
3533
.parse_next(i)?;

gix-object/src/commit/message/body.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use std::ops::Deref;
22

33
use winnow::{
4-
bytes::take_until1,
54
combinator::eof,
6-
error::{ErrorKind, ParseError},
5+
combinator::terminated,
6+
error::{ErrorKind, ParserError},
77
prelude::*,
8-
sequence::terminated,
8+
token::take_until1,
99
};
1010

1111
use crate::{
@@ -32,7 +32,7 @@ pub struct TrailerRef<'a> {
3232
pub value: &'a BStr,
3333
}
3434

35-
fn parse_single_line_trailer<'a, E: ParseError<&'a [u8]>>(i: &'a [u8]) -> IResult<&'a [u8], (&'a BStr, &'a BStr), E> {
35+
fn parse_single_line_trailer<'a, E: ParserError<&'a [u8]>>(i: &'a [u8]) -> IResult<&'a [u8], (&'a BStr, &'a BStr), E> {
3636
let (value, token) = terminated(take_until1(b":".as_ref()), b": ").parse_next(i.trim_end())?;
3737
if token.trim_end().len() != token.len() || value.trim_start().len() != value.len() {
3838
Err(winnow::error::ErrMode::from_error_kind(i, ErrorKind::Fail).cut())

gix-object/src/commit/message/decode.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
use winnow::{branch::alt, bytes::take_till1, combinator::eof, error::ParseError, prelude::*, sequence::terminated};
1+
use winnow::{
2+
combinator::alt, combinator::eof, combinator::terminated, error::ParserError, prelude::*, token::take_till1,
3+
};
24

35
use crate::bstr::{BStr, ByteSlice};
46

5-
pub(crate) fn newline<'a, E: ParseError<&'a [u8]>>(i: &'a [u8]) -> IResult<&'a [u8], &'a [u8], E> {
7+
pub(crate) fn newline<'a, E: ParserError<&'a [u8]>>(i: &'a [u8]) -> IResult<&'a [u8], &'a [u8], E> {
68
alt((b"\r\n", b"\n")).parse_next(i)
79
}
810

9-
fn subject_and_body<'a, E: ParseError<&'a [u8]>>(i: &'a [u8]) -> IResult<&'a [u8], (&'a BStr, Option<&'a BStr>), E> {
11+
fn subject_and_body<'a, E: ParserError<&'a [u8]>>(i: &'a [u8]) -> IResult<&'a [u8], (&'a BStr, Option<&'a BStr>), E> {
1012
let mut c = i;
1113
let mut consumed_bytes = 0;
1214
while !c.is_empty() {

gix-object/src/commit/ref_iter.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ use std::ops::Range;
44
use bstr::BStr;
55
use gix_hash::{oid, ObjectId};
66
use winnow::{
7-
branch::alt,
8-
bytes::take_till1,
7+
combinator::alt,
8+
combinator::terminated,
99
combinator::{eof, opt},
1010
prelude::*,
11-
sequence::terminated,
11+
token::take_till1,
1212
};
1313

1414
use crate::commit::SignedData;

gix-object/src/parse.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use bstr::{BStr, BString, ByteVec};
22
use winnow::{
3-
bytes::{take_till1, take_until0, take_while},
43
combinator::peek,
54
combinator::repeat,
6-
error::{ContextError, ParseError},
5+
combinator::{preceded, terminated},
6+
error::{AddContext, ParserError},
77
prelude::*,
8-
sequence::{preceded, terminated},
8+
token::{take_till1, take_until0, take_while},
99
Parser,
1010
};
1111

@@ -15,7 +15,7 @@ pub(crate) const NL: &[u8] = b"\n";
1515
pub(crate) const SPACE: &[u8] = b" ";
1616
const SPACE_OR_NL: &[u8] = b" \n";
1717

18-
pub(crate) fn any_header_field_multi_line<'a, E: ParseError<&'a [u8]> + ContextError<&'a [u8]>>(
18+
pub(crate) fn any_header_field_multi_line<'a, E: ParserError<&'a [u8]> + AddContext<&'a [u8]>>(
1919
i: &'a [u8],
2020
) -> IResult<&'a [u8], (&'a [u8], BString), E> {
2121
let (i, (k, o)) = peek((
@@ -44,15 +44,15 @@ pub(crate) fn any_header_field_multi_line<'a, E: ParseError<&'a [u8]> + ContextE
4444
Ok((&i[end - start_input + 1..], (k, out)))
4545
}
4646

47-
pub(crate) fn header_field<'a, T, E: ParseError<&'a [u8]>>(
47+
pub(crate) fn header_field<'a, T, E: ParserError<&'a [u8]>>(
4848
i: &'a [u8],
4949
name: &'static [u8],
5050
parse_value: impl Parser<&'a [u8], T, E>,
5151
) -> IResult<&'a [u8], T, E> {
5252
terminated(preceded(terminated(name, SPACE), parse_value), NL).parse_next(i)
5353
}
5454

55-
pub(crate) fn any_header_field<'a, T, E: ParseError<&'a [u8]>>(
55+
pub(crate) fn any_header_field<'a, T, E: ParserError<&'a [u8]>>(
5656
i: &'a [u8],
5757
parse_value: impl Parser<&'a [u8], T, E>,
5858
) -> IResult<&'a [u8], (&'a [u8], T), E> {
@@ -63,7 +63,7 @@ fn is_hex_digit_lc(b: u8) -> bool {
6363
matches!(b, b'0'..=b'9' | b'a'..=b'f')
6464
}
6565

66-
pub fn hex_hash<'a, E: ParseError<&'a [u8]>>(i: &'a [u8]) -> IResult<&'a [u8], &'a BStr, E> {
66+
pub fn hex_hash<'a, E: ParserError<&'a [u8]>>(i: &'a [u8]) -> IResult<&'a [u8], &'a BStr, E> {
6767
take_while(
6868
gix_hash::Kind::shortest().len_in_hex()..=gix_hash::Kind::longest().len_in_hex(),
6969
is_hex_digit_lc,
@@ -72,7 +72,7 @@ pub fn hex_hash<'a, E: ParseError<&'a [u8]>>(i: &'a [u8]) -> IResult<&'a [u8], &
7272
.map(|(i, hex)| (i, hex.as_bstr()))
7373
}
7474

75-
pub(crate) fn signature<'a, E: ParseError<&'a [u8]> + ContextError<&'a [u8]>>(
75+
pub(crate) fn signature<'a, E: ParserError<&'a [u8]> + AddContext<&'a [u8]>>(
7676
i: &'a [u8],
7777
) -> IResult<&'a [u8], gix_actor::SignatureRef<'a>, E> {
7878
gix_actor::signature::decode(i)

gix-object/src/tag/decode.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
use winnow::{
2-
branch::alt,
3-
bytes::{tag, take_until0, take_while},
2+
combinator::alt,
43
combinator::{eof, opt},
5-
error::{ContextError, ParseError},
4+
combinator::{preceded, terminated},
5+
error::{AddContext, ParserError},
66
prelude::*,
7-
sequence::{preceded, terminated},
87
stream::AsChar,
8+
token::{tag, take_until0, take_while},
99
};
1010

1111
use crate::{parse, parse::NL, BStr, ByteSlice, TagRef};
1212

13-
pub fn git_tag<'a, E: ParseError<&'a [u8]> + ContextError<&'a [u8]>>(i: &'a [u8]) -> IResult<&[u8], TagRef<'a>, E> {
13+
pub fn git_tag<'a, E: ParserError<&'a [u8]> + AddContext<&'a [u8]>>(i: &'a [u8]) -> IResult<&[u8], TagRef<'a>, E> {
1414
let (i, target) = (|i| parse::header_field(i, b"object", parse::hex_hash))
1515
.context("object <40 lowercase hex char>")
1616
.parse_next(i)?;
@@ -42,15 +42,15 @@ pub fn git_tag<'a, E: ParseError<&'a [u8]> + ContextError<&'a [u8]>>(i: &'a [u8]
4242
))
4343
}
4444

45-
pub fn message<'a, E: ParseError<&'a [u8]>>(i: &'a [u8]) -> IResult<&'a [u8], (&'a BStr, Option<&'a BStr>), E> {
45+
pub fn message<'a, E: ParserError<&'a [u8]>>(i: &'a [u8]) -> IResult<&'a [u8], (&'a BStr, Option<&'a BStr>), E> {
4646
const PGP_SIGNATURE_BEGIN: &[u8] = b"\n-----BEGIN PGP SIGNATURE-----";
4747
const PGP_SIGNATURE_END: &[u8] = b"-----END PGP SIGNATURE-----";
4848

4949
if i.is_empty() {
5050
return Ok((i, (i.as_bstr(), None)));
5151
}
5252
let (i, _) = tag(NL).parse_next(i)?;
53-
fn all_to_end<'a, E: ParseError<&'a [u8]>>(i: &'a [u8]) -> IResult<&'a [u8], (&'a [u8], &'a [u8]), E> {
53+
fn all_to_end<'a, E: ParserError<&'a [u8]>>(i: &'a [u8]) -> IResult<&'a [u8], (&'a [u8], &'a [u8]), E> {
5454
if i.is_empty() {
5555
// Empty message. That's OK.
5656
return Ok((&[], (&[], &[])));

gix-object/src/tag/ref_iter.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
use bstr::BStr;
22
use gix_hash::{oid, ObjectId};
33
use winnow::{
4-
bytes::take_while,
4+
combinator::terminated,
55
combinator::{eof, opt},
6-
error::ParseError,
6+
error::ParserError,
77
prelude::*,
8-
sequence::terminated,
98
stream::AsChar,
9+
token::take_while,
1010
};
1111

1212
use crate::{bstr::ByteSlice, parse, parse::NL, tag::decode, Kind, TagRefIter};

0 commit comments

Comments
 (0)