From 465d2a134c52a8790e1cdd5334dd4ebc652e8479 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 29 Jan 2025 13:28:58 -0600 Subject: [PATCH 01/16] fix(parser)!: Remove Parser::recognize --- src/combinator/impls.rs | 4 ---- src/parser.rs | 16 ---------------- 2 files changed, 20 deletions(-) diff --git a/src/combinator/impls.rs b/src/combinator/impls.rs index fae6de1b..74314840 100644 --- a/src/combinator/impls.rs +++ b/src/combinator/impls.rs @@ -376,10 +376,6 @@ where } } -/// Replaced with [`Take`] -#[deprecated(since = "0.6.14", note = "Replaced with `Take`")] -pub type Recognize = Take; - /// [`Parser`] implementation for [`Parser::take`] pub struct Take where diff --git a/src/parser.rs b/src/parser.rs index 563a5b0e..1c83a6f4 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -328,22 +328,6 @@ pub trait Parser { } } - /// Replaced with [`Parser::take`] - #[inline(always)] - #[deprecated(since = "0.6.14", note = "Replaced with `Parser::take`")] - fn recognize(self) -> impls::Take - where - Self: core::marker::Sized, - I: Stream, - { - impls::Take { - parser: self, - i: Default::default(), - o: Default::default(), - e: Default::default(), - } - } - /// Produce the consumed input with the output /// /// Functions similarly to [take][Parser::take] except it From 8ddd822dc8f83ff949b66f662c8de2fdda63e0d1 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 29 Jan 2025 13:29:28 -0600 Subject: [PATCH 02/16] fix(parser)!: Remove Parser::with_recognize --- src/combinator/impls.rs | 4 ---- src/parser.rs | 16 ---------------- 2 files changed, 20 deletions(-) diff --git a/src/combinator/impls.rs b/src/combinator/impls.rs index 74314840..1cc9d0bd 100644 --- a/src/combinator/impls.rs +++ b/src/combinator/impls.rs @@ -408,10 +408,6 @@ where } } -/// Replaced with [`WithTaken`] -#[deprecated(since = "0.6.14", note = "Replaced with `WithTaken`")] -pub type WithRecognized = WithTaken; - /// [`Parser`] implementation for [`Parser::with_taken`] pub struct WithTaken where diff --git a/src/parser.rs b/src/parser.rs index 1c83a6f4..4ffda918 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -370,22 +370,6 @@ pub trait Parser { } } - /// Replaced with [`Parser::with_taken`] - #[inline(always)] - #[deprecated(since = "0.6.14", note = "Replaced with `Parser::with_taken`")] - fn with_recognized(self) -> impls::WithTaken - where - Self: core::marker::Sized, - I: Stream, - { - impls::WithTaken { - parser: self, - i: Default::default(), - o: Default::default(), - e: Default::default(), - } - } - /// Produce the location of the consumed input as produced value. /// /// # Example From 3dabb23f83975f822b4ed335d3a191f02a7dad5a Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 29 Jan 2025 13:29:46 -0600 Subject: [PATCH 03/16] fix(parser)!: Remove unpeek --- src/parser.rs | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/parser.rs b/src/parser.rs index 4ffda918..bd2b1db5 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -1254,25 +1254,6 @@ where } } -/// Deprecated -#[inline(always)] -#[deprecated(since = "0.6.23")] -#[allow(deprecated)] -pub fn unpeek<'a, I, O, E>( - mut peek: impl FnMut(I) -> crate::error::IResult + 'a, -) -> impl FnMut(&mut I) -> crate::error::ModalResult -where - I: Clone, -{ - move |input| match peek((*input).clone()) { - Ok((i, o)) => { - *input = i; - Ok(o) - } - Err(err) => Err(err), - } -} - #[cfg(test)] mod tests { use super::*; From d1bf33c805028d43a28f29827a1fb0bd7f465d58 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 29 Jan 2025 13:30:27 -0600 Subject: [PATCH 04/16] fix(parser)!: Remove Located --- src/lib.rs | 2 -- src/stream/mod.rs | 4 ---- 2 files changed, 6 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index cd1b8549..92c9406b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -169,8 +169,6 @@ pub use error::Result; pub use parser::*; pub use stream::BStr; pub use stream::Bytes; -#[allow(deprecated)] -pub use stream::Located; pub use stream::LocatingSlice; pub use stream::Partial; pub use stream::Stateful; diff --git a/src/stream/mod.rs b/src/stream/mod.rs index 86add368..a2f4de68 100644 --- a/src/stream/mod.rs +++ b/src/stream/mod.rs @@ -62,10 +62,6 @@ pub use stateful::Stateful; /// UTF-8 Stream pub type Str<'i> = &'i str; -/// Deprecated, replaced with [`LocatingSlice`] -#[deprecated(since = "0.6.23", note = "Replaced with `LocatingSlice`")] -pub type Located = LocatingSlice; - /// Abstract method to calculate the input length pub trait SliceLen { /// Calculates the input length, as indicated by its name, From a141730c13c3f055f682260c00825eaee9456a00 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 29 Jan 2025 13:31:20 -0600 Subject: [PATCH 05/16] fix(parser)!: Remove parser types from combinator::* --- src/combinator/mod.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/combinator/mod.rs b/src/combinator/mod.rs index a7f540c5..21de3c41 100644 --- a/src/combinator/mod.rs +++ b/src/combinator/mod.rs @@ -173,8 +173,6 @@ pub mod impls; pub use self::branch::*; pub use self::core::*; pub use self::debug::*; -#[deprecated(since = "0.6.23", note = "Replaced with `combinator::impls`")] -pub use self::impls::*; pub use self::multi::*; pub use self::sequence::*; From 739a89ea46923f2fb581881b58c3e2b626fc9417 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 29 Jan 2025 13:31:41 -0600 Subject: [PATCH 06/16] fix(parser)!: Remove combinator::rest --- src/combinator/core.rs | 11 ----------- src/combinator/mod.rs | 2 +- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/src/combinator/core.rs b/src/combinator/core.rs index 0e8f0329..b3308881 100644 --- a/src/combinator/core.rs +++ b/src/combinator/core.rs @@ -3,17 +3,6 @@ use crate::error::{ModalError, ParserError}; use crate::stream::Stream; use crate::*; -/// Deprecated, replaced with [`token::rest`] -#[deprecated(since = "0.6.23", note = "replaced with `token::rest`")] -#[inline] -pub fn rest(input: &mut Input) -> Result<::Slice, Error> -where - Input: Stream, - Error: ParserError, -{ - crate::token::rest(input) -} - /// Deprecated, replaced with [`token::rest_len`] #[deprecated(since = "0.6.23", note = "replaced with `token::rest_len`")] #[inline] diff --git a/src/combinator/mod.rs b/src/combinator/mod.rs index 21de3c41..0be603c6 100644 --- a/src/combinator/mod.rs +++ b/src/combinator/mod.rs @@ -97,7 +97,7 @@ //! - [`line_ending`][crate::ascii::line_ending]: Recognizes an end of line (both `\n` and `\r\n`) //! - [`newline`][crate::ascii::newline]: Matches a newline character `\n` //! - [`till_line_ending`][crate::ascii::till_line_ending]: Recognizes a string of any char except `\r` or `\n` -//! - [`rest`]: Return the remaining input +//! - [`rest`][crate::token::rest]: Return the remaining input //! //! - [`alpha0`][crate::ascii::alpha0]: Recognizes zero or more lowercase and uppercase alphabetic characters: `[a-zA-Z]`. [`alpha1`][crate::ascii::alpha1] does the same but returns at least one character //! - [`alphanumeric0`][crate::ascii::alphanumeric0]: Recognizes zero or more numerical and alphabetic characters: `[0-9a-zA-Z]`. [`alphanumeric1`][crate::ascii::alphanumeric1] does the same but returns at least one character From fe1d66b927372fddd38d47ecb7ccd7109506ebb3 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 29 Jan 2025 13:31:47 -0600 Subject: [PATCH 07/16] fix(parser)!: Remove combinator::rest_len --- src/combinator/core.rs | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/combinator/core.rs b/src/combinator/core.rs index b3308881..2c77c6fc 100644 --- a/src/combinator/core.rs +++ b/src/combinator/core.rs @@ -3,17 +3,6 @@ use crate::error::{ModalError, ParserError}; use crate::stream::Stream; use crate::*; -/// Deprecated, replaced with [`token::rest_len`] -#[deprecated(since = "0.6.23", note = "replaced with `token::rest_len`")] -#[inline] -pub fn rest_len(input: &mut Input) -> Result -where - Input: Stream, - Error: ParserError, -{ - crate::token::rest_len(input) -} - /// Apply a [`Parser`], producing `None` on [`ErrMode::Backtrack`][crate::error::ErrMode::Backtrack]. /// /// To chain an error up, see [`cut_err`]. From 16511c2e73f851f45a957fdc0815fda2782804a5 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 29 Jan 2025 13:32:11 -0600 Subject: [PATCH 08/16] fix(parser)!: Remove ascii::escaped --- src/ascii/mod.rs | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/src/ascii/mod.rs b/src/ascii/mod.rs index fd9f041f..3d3e7ebc 100644 --- a/src/ascii/mod.rs +++ b/src/ascii/mod.rs @@ -1622,23 +1622,6 @@ where }) } -/// Deprecated, replaced with [`take_escaped`] -#[deprecated(since = "0.6.4", note = "Replaced with `take_escaped`")] -#[inline(always)] -pub fn escaped( - normal: Normal, - control_char: char, - escapable: Escapable, -) -> impl Parser::Slice, Error> -where - Input: StreamIsPartial + Stream + Compare, - Normal: Parser, - Escapable: Parser, - Error: ParserError, -{ - take_escaped(normal, control_char, escapable) -} - fn escaped_internal( input: &mut I, normal: &mut F, From 5e1c191455a5bbffbbbb795792513f584e172791 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 29 Jan 2025 13:32:45 -0600 Subject: [PATCH 09/16] fix(parser)!: Remove PResult --- src/error.rs | 4 ---- src/lib.rs | 4 ---- 2 files changed, 8 deletions(-) diff --git a/src/error.rs b/src/error.rs index 8fe7c276..349359ba 100644 --- a/src/error.rs +++ b/src/error.rs @@ -48,10 +48,6 @@ pub type Result = core::result::Result; /// - [`ParserError::into_inner`] pub type ModalResult = Result>; -/// Deprecated, replaced with [`ModalResult`] -#[deprecated(since = "0.6.25", note = "Replaced with ModalResult")] -pub type PResult = ModalResult; - /// Deprecated, replaced with [`ModalResult`] #[deprecated(since = "0.6.25", note = "Replaced with `ModalResult`")] pub type IResult> = ModalResult<(I, O), E>; diff --git a/src/lib.rs b/src/lib.rs index 92c9406b..e312d0cc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -151,8 +151,6 @@ pub mod prelude { pub use crate::stream::StreamIsPartial as _; pub use crate::ModalParser; pub use crate::ModalResult; - #[allow(deprecated)] - pub use crate::PResult; pub use crate::Parser; #[cfg(feature = "unstable-recover")] #[cfg(feature = "std")] @@ -163,8 +161,6 @@ pub mod prelude { } pub use error::ModalResult; -#[allow(deprecated)] -pub use error::PResult; pub use error::Result; pub use parser::*; pub use stream::BStr; From 5b4beea867b154f7ac44cab5d2c93b291c5c1ce9 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 29 Jan 2025 13:33:28 -0600 Subject: [PATCH 10/16] fix(parser)!: Remove IResult --- src/error.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/error.rs b/src/error.rs index 349359ba..adf6a274 100644 --- a/src/error.rs +++ b/src/error.rs @@ -48,10 +48,6 @@ pub type Result = core::result::Result; /// - [`ParserError::into_inner`] pub type ModalResult = Result>; -/// Deprecated, replaced with [`ModalResult`] -#[deprecated(since = "0.6.25", note = "Replaced with `ModalResult`")] -pub type IResult> = ModalResult<(I, O), E>; - #[cfg(test)] pub(crate) type TestResult = ModalResult>; From a3845e1656197a1668201be059f3a27da65c2d65 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 29 Jan 2025 13:34:18 -0600 Subject: [PATCH 11/16] fix(parser)!: Remove InputError::new --- src/error.rs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/error.rs b/src/error.rs index adf6a274..20a2a44b 100644 --- a/src/error.rs +++ b/src/error.rs @@ -508,14 +508,6 @@ pub struct InputError { } impl InputError { - /// Creates a new basic error - #[inline] - #[deprecated(since = "0.6.26", note = "replaced with `InputError::at`")] - #[allow(deprecated)] - pub fn new(input: I, kind: ErrorKind) -> Self { - Self { input, kind } - } - /// Creates a new basic error #[inline] pub fn at(input: I) -> Self { From 49f455ba5901dea95b4f704f4ed9529dcc232d5f Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 29 Jan 2025 13:36:50 -0600 Subject: [PATCH 12/16] fix(error)!: Remove ParserError::from_error_kind --- examples/custom_error.rs | 2 +- src/combinator/tests.rs | 6 ++-- src/error.rs | 48 +++++++++++--------------------- tests/testsuite/custom_errors.rs | 9 +++--- 4 files changed, 25 insertions(+), 40 deletions(-) diff --git a/examples/custom_error.rs b/examples/custom_error.rs index a4f9234c..7a9386ad 100644 --- a/examples/custom_error.rs +++ b/examples/custom_error.rs @@ -21,7 +21,7 @@ impl ParserError for CustomError { type Inner = Self; #[allow(deprecated)] - fn from_error_kind(input: &I, _: ErrorKind) -> Self { + fn from_input(input: &I) -> Self { CustomError::Winnow(input.clone()) } diff --git a/src/combinator/tests.rs b/src/combinator/tests.rs index 6926c047..10b189f2 100644 --- a/src/combinator/tests.rs +++ b/src/combinator/tests.rs @@ -121,7 +121,7 @@ impl ParserError for CustomError { type Inner = Self; #[allow(deprecated)] - fn from_error_kind(_: &I, _: crate::error::ErrorKind) -> Self { + fn from_input(_: &I) -> Self { CustomError } @@ -1331,7 +1331,7 @@ fn alt_test() { type Inner = Self; #[allow(deprecated)] - fn from_error_kind(input: &I, _: crate::error::ErrorKind) -> Self { + fn from_input(input: &I) -> Self { ErrorStr(format!("custom error message: ({input:?})")) } @@ -3471,7 +3471,7 @@ impl ParserError for NilError { type Inner = Self; #[allow(deprecated)] - fn from_error_kind(_: &I, _: crate::error::ErrorKind) -> NilError { + fn from_input(_: &I) -> NilError { NilError } diff --git a/src/error.rs b/src/error.rs index 20a2a44b..819c8e99 100644 --- a/src/error.rs +++ b/src/error.rs @@ -181,9 +181,8 @@ impl> ParserError for ErrMode { type Inner = E; #[inline(always)] - #[allow(deprecated)] - fn from_error_kind(input: &I, kind: ErrorKind) -> Self { - ErrMode::Backtrack(E::from_error_kind(input, kind)) + fn from_input(input: &I) -> Self { + ErrMode::Backtrack(E::from_input(input)) } #[inline(always)] @@ -344,17 +343,8 @@ pub trait ParserError: Sized { /// Mostly used for [`ErrMode`] type Inner; - /// Deprecated, replaced with [`ParserError::from_input`] - #[deprecated(since = "0.6.26", note = "replaced with `ParserError::from_input`")] - #[allow(deprecated)] - fn from_error_kind(input: &I, kind: ErrorKind) -> Self; - /// Creates an error from the input position - #[inline(always)] - fn from_input(input: &I) -> Self { - #[allow(deprecated)] - Self::from_error_kind(input, ErrorKind::Fail) - } + fn from_input(input: &I) -> Self; /// Process a parser assertion #[inline(always)] @@ -365,7 +355,7 @@ pub trait ParserError: Sized { #[cfg(debug_assertions)] panic!("assert `{_message}` failed at {input:#?}"); #[cfg(not(debug_assertions))] - Self::from_error_kind(input, ErrorKind::Assert) + Self::from_input(input) } /// There was not enough data to determine the appropriate action @@ -381,7 +371,7 @@ pub trait ParserError: Sized { Self::from_input(input) } - /// Like [`ParserError::from_error_kind`] but merges it with the existing error. + /// Like [`ParserError::from_input`] but merges it with the existing error. /// /// This is useful when backtracking through a parse tree, accumulating error context on the /// way. @@ -476,7 +466,7 @@ pub trait FromRecoverableError { /// /// This trait is required by the [`Parser::try_map`] combinator. pub trait FromExternalError { - /// Like [`ParserError::from_error_kind`] but also include an external error. + /// Like [`ParserError::from_input`] but also include an external error. #[allow(deprecated)] fn from_external_error(input: &I, kind: ErrorKind, e: E) -> Self; } @@ -543,11 +533,11 @@ impl ParserError for InputError { type Inner = Self; #[inline] - #[allow(deprecated)] - fn from_error_kind(input: &I, kind: ErrorKind) -> Self { + fn from_input(input: &I) -> Self { + #[allow(deprecated)] Self { input: input.clone(), - kind, + kind: ErrorKind::Fail, } } @@ -625,8 +615,7 @@ impl ParserError for EmptyError { type Inner = Self; #[inline(always)] - #[allow(deprecated)] - fn from_error_kind(_: &I, _: ErrorKind) -> Self { + fn from_input(_: &I) -> Self { Self } @@ -677,8 +666,7 @@ impl ParserError for () { type Inner = Self; #[inline] - #[allow(deprecated)] - fn from_error_kind(_: &I, _: ErrorKind) -> Self {} + fn from_input(_: &I) -> Self {} #[inline(always)] fn into_inner(self) -> Result { @@ -770,8 +758,7 @@ impl ParserError for ContextError { type Inner = Self; #[inline] - #[allow(deprecated)] - fn from_error_kind(_input: &I, _kind: ErrorKind) -> Self { + fn from_input(_input: &I) -> Self { Self::new() } @@ -1092,11 +1079,11 @@ where { type Inner = Self; - #[allow(deprecated)] - fn from_error_kind(input: &I, kind: ErrorKind) -> Self { + fn from_input(input: &I) -> Self { + #[allow(deprecated)] TreeError::Base(TreeErrorBase { input: input.clone(), - kind, + kind: ErrorKind::Fail, cause: None, }) } @@ -1342,9 +1329,8 @@ impl ParserError for ErrorKind { type Inner = Self; #[inline] - #[allow(deprecated)] - fn from_error_kind(_input: &I, kind: ErrorKind) -> Self { - kind + fn from_input(_input: &I) -> Self { + Self::Fail } #[inline(always)] diff --git a/tests/testsuite/custom_errors.rs b/tests/testsuite/custom_errors.rs index 17646c8c..5174b19d 100644 --- a/tests/testsuite/custom_errors.rs +++ b/tests/testsuite/custom_errors.rs @@ -5,7 +5,6 @@ use winnow::ascii::digit1 as digit; use winnow::combinator::repeat; use winnow::combinator::terminated; #[allow(deprecated)] -use winnow::error::ErrorKind; use winnow::error::ParserError; use winnow::prelude::*; use winnow::stream::Stream; @@ -18,8 +17,8 @@ impl<'a> ParserError> for CustomError { type Inner = Self; #[allow(deprecated)] - fn from_error_kind(_: &Partial<&'a str>, kind: ErrorKind) -> Self { - CustomError(format!("error code was: {kind:?}")) + fn from_input(_: &Partial<&'a str>) -> Self { + CustomError("error".to_owned()) } #[allow(deprecated)] @@ -27,9 +26,9 @@ impl<'a> ParserError> for CustomError { self, _: &Partial<&'a str>, _: & as Stream>::Checkpoint, - kind: ErrorKind, + _: winnow::error::ErrorKind, ) -> Self { - CustomError(format!("{self:?}\nerror code was: {kind:?}")) + self } fn into_inner(self) -> Result { From f056414ab78f6cd27695c929a45c8f82c2217c86 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 29 Jan 2025 13:39:25 -0600 Subject: [PATCH 13/16] fix(error)!: Remove `kind` param from `from_external_error` --- examples/custom_error.rs | 4 +--- src/combinator/impls.rs | 2 +- src/combinator/multi.rs | 2 +- src/error.rs | 26 +++++++++++++------------- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/examples/custom_error.rs b/examples/custom_error.rs index 7a9386ad..561920b7 100644 --- a/examples/custom_error.rs +++ b/examples/custom_error.rs @@ -1,7 +1,5 @@ use winnow::error::AddContext; use winnow::error::ErrMode; -#[allow(deprecated)] -use winnow::error::ErrorKind; use winnow::error::FromExternalError; use winnow::error::ParserError; use winnow::prelude::*; @@ -47,7 +45,7 @@ impl FromExtern { #[inline] #[allow(deprecated)] - fn from_external_error(input: &I, _: ErrorKind, e: E) -> Self { + fn from_external_error(input: &I, e: E) -> Self { CustomError::External { cause: Box::new(e), input: input.clone(), diff --git a/src/combinator/impls.rs b/src/combinator/impls.rs index 1cc9d0bd..c4cef40f 100644 --- a/src/combinator/impls.rs +++ b/src/combinator/impls.rs @@ -95,7 +95,7 @@ where let res = (self.map)(o).map_err(|err| { input.reset(&start); #[allow(deprecated)] - E::from_external_error(input, crate::error::ErrorKind::Verify, err) + E::from_external_error(input, err) }); trace_result("verify", &res); res diff --git a/src/combinator/multi.rs b/src/combinator/multi.rs index 7d4b592c..7992bdb6 100644 --- a/src/combinator/multi.rs +++ b/src/combinator/multi.rs @@ -1606,7 +1606,7 @@ where Err(e) => { input.reset(&start); #[allow(deprecated)] - let res = Err(E::from_external_error(input, ErrorKind::Verify, e)); + let res = Err(E::from_external_error(input, e)); super::debug::trace_result("try_fold", &res); return res; } diff --git a/src/error.rs b/src/error.rs index 819c8e99..d6bb59f9 100644 --- a/src/error.rs +++ b/src/error.rs @@ -269,8 +269,8 @@ where { #[inline(always)] #[allow(deprecated)] - fn from_external_error(input: &I, kind: ErrorKind, e: EXT) -> Self { - ErrMode::Backtrack(E::from_external_error(input, kind, e)) + fn from_external_error(input: &I, e: EXT) -> Self { + ErrMode::Backtrack(E::from_external_error(input, e)) } } @@ -468,7 +468,7 @@ pub trait FromRecoverableError { pub trait FromExternalError { /// Like [`ParserError::from_input`] but also include an external error. #[allow(deprecated)] - fn from_external_error(input: &I, kind: ErrorKind, e: E) -> Self; + fn from_external_error(input: &I, e: E) -> Self; } /// Equivalent of `From` implementation to avoid orphan rules in bits parsers @@ -567,10 +567,10 @@ impl FromExternalError for InputError { /// Create a new error from an input position and an external error #[inline] #[allow(deprecated)] - fn from_external_error(input: &I, kind: ErrorKind, _e: E) -> Self { + fn from_external_error(input: &I, _e: E) -> Self { Self { input: input.clone(), - kind, + kind: ErrorKind::Fail, } } } @@ -644,7 +644,7 @@ impl FromRecoverableError for EmptyError { impl FromExternalError for EmptyError { #[inline(always)] #[allow(deprecated)] - fn from_external_error(_input: &I, _kind: ErrorKind, _e: E) -> Self { + fn from_external_error(_input: &I, _e: E) -> Self { Self } } @@ -692,7 +692,7 @@ impl FromRecoverableError for () { impl FromExternalError for () { #[inline] #[allow(deprecated)] - fn from_external_error(_input: &I, _kind: ErrorKind, _e: E) -> Self {} + fn from_external_error(_input: &I, _e: E) -> Self {} } impl ErrorConvert<()> for () { @@ -802,7 +802,7 @@ impl FromExternalError { #[inline] #[allow(deprecated)] - fn from_external_error(_input: &I, _kind: ErrorKind, e: E) -> Self { + fn from_external_error(_input: &I, e: E) -> Self { let mut err = Self::new(); { err.cause = Some(Box::new(e)); @@ -816,7 +816,7 @@ impl FromExternalError impl FromExternalError for ContextError { #[inline] #[allow(deprecated)] - fn from_external_error(_input: &I, _kind: ErrorKind, _e: E) -> Self { + fn from_external_error(_input: &I, _e: E) -> Self { let err = Self::new(); err } @@ -1157,10 +1157,10 @@ where I: Clone, { #[allow(deprecated)] - fn from_external_error(input: &I, kind: ErrorKind, e: E) -> Self { + fn from_external_error(input: &I, e: E) -> Self { TreeError::Base(TreeErrorBase { input: input.clone(), - kind, + kind: ErrorKind::Fail, cause: Some(Box::new(e)), }) } @@ -1347,8 +1347,8 @@ impl FromExternalError for ErrorKind { /// Create a new error from an input position and an external error #[inline] #[allow(deprecated)] - fn from_external_error(_input: &I, kind: ErrorKind, _e: E) -> Self { - kind + fn from_external_error(_input: &I, _e: E) -> Self { + Self::Fail } } From 2b9a0d7605737a567f4da67134da687852052324 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 29 Jan 2025 13:41:26 -0600 Subject: [PATCH 14/16] fix(error)!: Remove `kind` param from `ParserError::apend` --- src/combinator/branch.rs | 10 ++++----- src/combinator/multi.rs | 36 +++++++++++++++----------------- src/combinator/tests.rs | 7 +------ src/error.rs | 17 +++++---------- tests/testsuite/custom_errors.rs | 7 +------ 5 files changed, 28 insertions(+), 49 deletions(-) diff --git a/src/combinator/branch.rs b/src/combinator/branch.rs index 651908de..5d3c01a1 100644 --- a/src/combinator/branch.rs +++ b/src/combinator/branch.rs @@ -1,6 +1,4 @@ use crate::combinator::trace; -#[allow(deprecated)] -use crate::error::ErrorKind; use crate::error::ParserError; use crate::stream::Stream; use crate::*; @@ -148,7 +146,7 @@ impl, P: Parser> Alt Err(e.append(input, &start, ErrorKind::Alt)), + Some(e) => Err(e.append(input, &start)), None => Err(ParserError::assert( input, "`alt` needs at least one parser", @@ -177,7 +175,7 @@ impl, P: Parser> Alt for &mut #[allow(deprecated)] match error { - Some(e) => Err(e.append(input, &start, ErrorKind::Alt)), + Some(e) => Err(e.append(input, &start)), None => Err(ParserError::assert( input, "`alt` needs at least one parser", @@ -256,7 +254,7 @@ macro_rules! alt_trait_inner( }); ($it:tt, $self:expr, $input:expr, $start:ident, $err:expr, $head:ident) => ({ #[allow(deprecated)] - Err($err.append($input, &$start, ErrorKind::Alt)) + Err($err.append($input, &$start)) }); ); @@ -310,7 +308,7 @@ macro_rules! permutation_trait_impl( // There are remaining parsers, and all errored on the remaining input input.reset(&start); #[allow(deprecated)] - return Err(err.append(input, &start, ErrorKind::Alt)); + return Err(err.append(input, &start)); } // All parsers were applied diff --git a/src/combinator/multi.rs b/src/combinator/multi.rs index 7992bdb6..89eb54e7 100644 --- a/src/combinator/multi.rs +++ b/src/combinator/multi.rs @@ -1,8 +1,6 @@ //! Combinators applying their child parser multiple times use crate::combinator::trace; -#[allow(deprecated)] -use crate::error::ErrorKind; use crate::error::FromExternalError; use crate::error::ParserError; use crate::stream::Accumulate; @@ -501,7 +499,7 @@ where let start = i.checkpoint(); #[allow(deprecated)] match f.parse_next(i) { - Err(e) => Err(e.append(i, &start, ErrorKind::Repeat)), + Err(e) => Err(e.append(i, &start)), Ok(o) => { let mut acc = C::initial(None); acc.accumulate(o); @@ -558,7 +556,7 @@ where } Err(e) => { #[allow(deprecated)] - return Err(e.append(i, &start, ErrorKind::Repeat)); + return Err(e.append(i, &start)); } } } @@ -599,7 +597,7 @@ where Err(e) if e.is_backtrack() => { if count < min { #[allow(deprecated)] - return Err(e.append(input, &start, ErrorKind::Repeat)); + return Err(e.append(input, &start)); } else { input.reset(&start); return Ok(res); @@ -697,7 +695,7 @@ where i.reset(&start); #[allow(deprecated)] match f.parse_next(i) { - Err(e) => return Err(e.append(i, &start, ErrorKind::Repeat)), + Err(e) => return Err(e.append(i, &start)), Ok(o) => { // infinite loop check: the parser must always consume if i.eof_offset() == len { @@ -747,7 +745,7 @@ where } Err(e) => { #[allow(deprecated)] - return Err(e.append(i, &start, ErrorKind::Repeat)); + return Err(e.append(i, &start)); } } } @@ -764,7 +762,7 @@ where match f.parse_next(i) { Err(e) => { #[allow(deprecated)] - return Err(e.append(i, &start, ErrorKind::Repeat)); + return Err(e.append(i, &start)); } Ok(o) => { // infinite loop check: the parser must always consume @@ -1056,7 +1054,7 @@ where match parser.parse_next(input) { Err(e) => { #[allow(deprecated)] - return Err(e.append(input, &start, ErrorKind::Repeat)); + return Err(e.append(input, &start)); } Ok(o) => { acc.accumulate(o); @@ -1069,7 +1067,7 @@ where match separator.parse_next(input) { Err(e) => { #[allow(deprecated)] - return Err(e.append(input, &start, ErrorKind::Repeat)); + return Err(e.append(input, &start)); } Ok(_) => { // infinite loop check @@ -1083,7 +1081,7 @@ where match parser.parse_next(input) { Err(e) => { #[allow(deprecated)] - return Err(e.append(input, &start, ErrorKind::Repeat)); + return Err(e.append(input, &start)); } Ok(o) => { acc.accumulate(o); @@ -1127,7 +1125,7 @@ where return Ok(acc); } else { #[allow(deprecated)] - return Err(e.append(input, &start, ErrorKind::Repeat)); + return Err(e.append(input, &start)); } } Err(e) => return Err(e), @@ -1143,7 +1141,7 @@ where Err(e) if e.is_backtrack() => { if index < min { #[allow(deprecated)] - return Err(e.append(input, &start, ErrorKind::Repeat)); + return Err(e.append(input, &start)); } else { input.reset(&start); return Ok(acc); @@ -1165,7 +1163,7 @@ where Err(e) if e.is_backtrack() => { if index < min { #[allow(deprecated)] - return Err(e.append(input, &start, ErrorKind::Repeat)); + return Err(e.append(input, &start)); } else { input.reset(&start); return Ok(acc); @@ -1348,7 +1346,7 @@ where } Err(e) => { #[allow(deprecated)] - return Err(e.append(i, &start, ErrorKind::Repeat)); + return Err(e.append(i, &start)); } } } @@ -1415,7 +1413,7 @@ where let start = input.checkpoint(); #[allow(deprecated)] match f.parse_next(input) { - Err(e) => Err(e.append(input, &start, ErrorKind::Repeat)), + Err(e) => Err(e.append(input, &start)), Ok(o1) => { let mut acc = g(init, o1); @@ -1489,7 +1487,7 @@ where Err(err) if err.is_backtrack() => { if count < min { #[allow(deprecated)] - return Err(err.append(input, &start, ErrorKind::Repeat)); + return Err(err.append(input, &start)); } else { input.reset(&start); break; @@ -1551,7 +1549,7 @@ where Err(err) if err.is_backtrack() => { if count < min { #[allow(deprecated)] - return Err(err.append(input, &start, ErrorKind::Repeat)); + return Err(err.append(input, &start)); } else { input.reset(&start); break; @@ -1616,7 +1614,7 @@ where Err(err) if err.is_backtrack() => { if count < min { #[allow(deprecated)] - return Err(err.append(input, &start, ErrorKind::Repeat)); + return Err(err.append(input, &start)); } else { input.reset(&start); break; diff --git a/src/combinator/tests.rs b/src/combinator/tests.rs index 10b189f2..246f3712 100644 --- a/src/combinator/tests.rs +++ b/src/combinator/tests.rs @@ -1336,12 +1336,7 @@ fn alt_test() { } #[allow(deprecated)] - fn append( - self, - input: &I, - _: &::Checkpoint, - _: crate::error::ErrorKind, - ) -> Self { + fn append(self, input: &I, _: &::Checkpoint) -> Self { ErrorStr(format!("custom error message: ({input:?}) - {self:?}")) } diff --git a/src/error.rs b/src/error.rs index d6bb59f9..a51668b7 100644 --- a/src/error.rs +++ b/src/error.rs @@ -199,10 +199,9 @@ impl> ParserError for ErrMode { } #[inline] - #[allow(deprecated)] - fn append(self, input: &I, token_start: &::Checkpoint, kind: ErrorKind) -> Self { + fn append(self, input: &I, token_start: &::Checkpoint) -> Self { match self { - ErrMode::Backtrack(e) => ErrMode::Backtrack(e.append(input, token_start, kind)), + ErrMode::Backtrack(e) => ErrMode::Backtrack(e.append(input, token_start)), e => e, } } @@ -376,13 +375,7 @@ pub trait ParserError: Sized { /// This is useful when backtracking through a parse tree, accumulating error context on the /// way. #[inline] - #[allow(deprecated)] - fn append( - self, - _input: &I, - _token_start: &::Checkpoint, - _kind: ErrorKind, - ) -> Self { + fn append(self, _input: &I, _token_start: &::Checkpoint) -> Self { self } @@ -1089,12 +1082,12 @@ where } #[allow(deprecated)] - fn append(self, input: &I, token_start: &::Checkpoint, kind: ErrorKind) -> Self { + fn append(self, input: &I, token_start: &::Checkpoint) -> Self { let mut input = input.clone(); input.reset(token_start); let frame = TreeErrorFrame::Kind(TreeErrorBase { input, - kind, + kind: ErrorKind::Fail, cause: None, }); self.append_frame(frame) diff --git a/tests/testsuite/custom_errors.rs b/tests/testsuite/custom_errors.rs index 5174b19d..b860643c 100644 --- a/tests/testsuite/custom_errors.rs +++ b/tests/testsuite/custom_errors.rs @@ -22,12 +22,7 @@ impl<'a> ParserError> for CustomError { } #[allow(deprecated)] - fn append( - self, - _: &Partial<&'a str>, - _: & as Stream>::Checkpoint, - _: winnow::error::ErrorKind, - ) -> Self { + fn append(self, _: &Partial<&'a str>, _: & as Stream>::Checkpoint) -> Self { self } From c9e3eb01a948cf7f8740738f4f05c414c68e3ec3 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 29 Jan 2025 13:44:18 -0600 Subject: [PATCH 15/16] fix(error)!: Remove ErrorKind --- src/ascii/tests.rs | 76 -------------------- src/binary/tests.rs | 7 -- src/combinator/tests.rs | 42 ----------- src/error.rs | 146 +++----------------------------------- src/macros/tests.rs | 10 --- src/parser.rs | 2 - src/token/tests.rs | 28 -------- tests/testsuite/issues.rs | 2 - tests/testsuite/utf8.rs | 6 -- 9 files changed, 9 insertions(+), 310 deletions(-) diff --git a/src/ascii/tests.rs b/src/ascii/tests.rs index c4e40a59..8c71438a 100644 --- a/src/ascii/tests.rs +++ b/src/ascii/tests.rs @@ -56,7 +56,6 @@ Err( 51, 52, ], - kind: Fail, }, ), ) @@ -116,7 +115,6 @@ Err( 99, 100, ], - kind: Fail, }, ), ) @@ -154,7 +152,6 @@ Err( 50, 51, ], - kind: Fail, }, ), ) @@ -176,7 +173,6 @@ Err( 49, 50, ], - kind: Fail, }, ), ) @@ -268,7 +264,6 @@ Err( input: [ 32, ], - kind: Fail, }, ), ) @@ -288,7 +283,6 @@ Err( 99, 100, ], - kind: Fail, }, ), ) @@ -326,7 +320,6 @@ Err( 50, 51, ], - kind: Fail, }, ), ) @@ -348,7 +341,6 @@ Err( 49, 50, ], - kind: Fail, }, ), ) @@ -476,7 +468,6 @@ Err( Backtrack( InputError { input: "1234", - kind: Fail, }, ), ) @@ -517,7 +508,6 @@ Err( Backtrack( InputError { input: "abcd", - kind: Fail, }, ), ) @@ -545,7 +535,6 @@ Err( Backtrack( InputError { input: "a123", - kind: Fail, }, ), ) @@ -560,7 +549,6 @@ Err( Backtrack( InputError { input: "azé12", - kind: Fail, }, ), ) @@ -627,7 +615,6 @@ Err( Backtrack( InputError { input: " ", - kind: Fail, }, ), ) @@ -642,7 +629,6 @@ Err( Backtrack( InputError { input: "abcd", - kind: Fail, }, ), ) @@ -670,7 +656,6 @@ Err( Backtrack( InputError { input: "a123", - kind: Fail, }, ), ) @@ -685,7 +670,6 @@ Err( Backtrack( InputError { input: "azé12", - kind: Fail, }, ), ) @@ -932,7 +916,6 @@ Err( Backtrack( InputError { input: "\rÂßÇáƒƭèř", - kind: Fail, }, ), ) @@ -1009,7 +992,6 @@ Err( input: [ 103, ], - kind: Fail, }, ), ) @@ -1028,7 +1010,6 @@ Err( input: [ 71, ], - kind: Fail, }, ), ) @@ -1089,7 +1070,6 @@ Err( input: [ 56, ], - kind: Fail, }, ), ) @@ -1247,7 +1227,6 @@ Err( input: [ 13, ], - kind: Fail, }, ), ) @@ -1265,7 +1244,6 @@ Err( 13, 97, ], - kind: Fail, }, ), ) @@ -1294,7 +1272,6 @@ Err( Backtrack( InputError { input: "\r", - kind: Fail, }, ), ) @@ -1309,7 +1286,6 @@ Err( Backtrack( InputError { input: "\ra", - kind: Fail, }, ), ) @@ -1365,7 +1341,6 @@ Err( input: [ 13, ], - kind: Fail, }, ), ) @@ -1383,7 +1358,6 @@ Err( 13, 97, ], - kind: Fail, }, ), ) @@ -1425,7 +1399,6 @@ Err( Backtrack( InputError { input: "\r", - kind: Fail, }, ), ) @@ -1440,7 +1413,6 @@ Err( Backtrack( InputError { input: "\ra", - kind: Fail, }, ), ) @@ -1465,7 +1437,6 @@ Err( input: [ 59, ], - kind: Fail, }, ), ) @@ -1549,7 +1520,6 @@ Err( 48, 59, ], - kind: Fail, }, ), ) @@ -1574,7 +1544,6 @@ Err( input: [ 59, ], - kind: Fail, }, ), ) @@ -1638,7 +1607,6 @@ Err( 48, 59, ], - kind: Fail, }, ), ) @@ -1707,7 +1675,6 @@ Err( 48, 59, ], - kind: Fail, }, ), ) @@ -1732,7 +1699,6 @@ Err( input: [ 59, ], - kind: Fail, }, ), ) @@ -1819,7 +1785,6 @@ Err( 50, 59, ], - kind: Fail, }, ), ) @@ -1846,7 +1811,6 @@ Err( 49, 59, ], - kind: Fail, }, ), ) @@ -1894,7 +1858,6 @@ Err( 102, 59, ], - kind: Fail, }, ), ) @@ -1926,7 +1889,6 @@ Err( 102, 102, ], - kind: Fail, }, ), ) @@ -2037,7 +1999,6 @@ Err( Backtrack( InputError { input: "", - kind: Fail, }, ), ) @@ -2272,7 +2233,6 @@ Err( Backtrack( InputError { input: [], - kind: Fail, }, ), ) @@ -2289,7 +2249,6 @@ Err( input: [ 65, ], - kind: Fail, }, ), ) @@ -2407,7 +2366,6 @@ Err( Backtrack( InputError { input: "", - kind: Fail, }, ), ) @@ -2422,7 +2380,6 @@ Err( Backtrack( InputError { input: "A", - kind: Fail, }, ), ) @@ -2587,7 +2544,6 @@ Err( Backtrack( InputError { input: [], - kind: Fail, }, ), ) @@ -2604,7 +2560,6 @@ Err( input: [ 65, ], - kind: Fail, }, ), ) @@ -2761,7 +2716,6 @@ Err( Backtrack( InputError { input: "", - kind: Fail, }, ), ) @@ -2776,7 +2730,6 @@ Err( Backtrack( InputError { input: "A", - kind: Fail, }, ), ) @@ -2907,7 +2860,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -2976,7 +2928,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -3013,7 +2964,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -3038,7 +2988,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -3124,7 +3073,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -3147,7 +3095,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -3184,7 +3131,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -3209,7 +3155,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -3338,7 +3283,6 @@ Err( input: "1234", partial: true, }, - kind: Fail, }, ), ) @@ -3388,7 +3332,6 @@ Err( input: "abcd", partial: true, }, - kind: Fail, }, ), ) @@ -3420,7 +3363,6 @@ Err( input: "a123", partial: true, }, - kind: Fail, }, ), ) @@ -3438,7 +3380,6 @@ Err( input: "azé12", partial: true, }, - kind: Fail, }, ), ) @@ -3514,7 +3455,6 @@ Err( input: " ", partial: true, }, - kind: Fail, }, ), ) @@ -3532,7 +3472,6 @@ Err( input: "abcd", partial: true, }, - kind: Fail, }, ), ) @@ -3564,7 +3503,6 @@ Err( input: "a123", partial: true, }, - kind: Fail, }, ), ) @@ -3582,7 +3520,6 @@ Err( input: "azé12", partial: true, }, - kind: Fail, }, ), ) @@ -3846,7 +3783,6 @@ Err( input: "\rÂßÇáƒƭèř", partial: true, }, - kind: Fail, }, ), ) @@ -3928,7 +3864,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -3950,7 +3885,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -4017,7 +3951,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -4212,7 +4145,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -4261,7 +4193,6 @@ Err( input: "\ra", partial: true, }, - kind: Fail, }, ), ) @@ -4341,7 +4272,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -4406,7 +4336,6 @@ Err( input: "\ra", partial: true, }, - kind: Fail, }, ), ) @@ -4434,7 +4363,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -4536,7 +4464,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -4566,7 +4493,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -4620,7 +4546,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -4655,7 +4580,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) diff --git a/src/binary/tests.rs b/src/binary/tests.rs index 5dfea22c..b14303e1 100644 --- a/src/binary/tests.rs +++ b/src/binary/tests.rs @@ -3249,7 +3249,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -3271,7 +3270,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -3504,7 +3502,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -3565,7 +3562,6 @@ Err( input: [], partial: false, }, - kind: Fail, }, ), ) @@ -3583,7 +3579,6 @@ Err( input: [], partial: false, }, - kind: Fail, }, ), ) @@ -3608,7 +3603,6 @@ Err( ], partial: false, }, - kind: Fail, }, ), ) @@ -3626,7 +3620,6 @@ Err( input: [], partial: false, }, - kind: Fail, }, ), ) diff --git a/src/combinator/tests.rs b/src/combinator/tests.rs index 246f3712..5c97cdeb 100644 --- a/src/combinator/tests.rs +++ b/src/combinator/tests.rs @@ -47,7 +47,6 @@ Err( 100, 33, ], - kind: Fail, }, ), ) @@ -85,7 +84,6 @@ Err( Backtrack( InputError { input: "Hello, world!", - kind: Fail, }, ), ) @@ -181,7 +179,6 @@ Err( input: [ 50, ], - kind: Fail, }, ), ) @@ -395,7 +392,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -425,7 +421,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -510,7 +505,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -583,7 +577,6 @@ Err( 102, 103, ], - kind: Fail, }, ), ) @@ -638,7 +631,6 @@ Err( 102, 103, ], - kind: Fail, }, ), ) @@ -660,7 +652,6 @@ Err( Backtrack( InputError { input: "string", - kind: Fail, }, ), ) @@ -675,7 +666,6 @@ Err( Backtrack( InputError { input: "another string", - kind: Fail, }, ), ) @@ -704,7 +694,6 @@ Err( 109, 110, ], - kind: Fail, }, ), ) @@ -799,7 +788,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -825,7 +813,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -847,7 +834,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -933,7 +919,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -959,7 +944,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -981,7 +965,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -1067,7 +1050,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -1093,7 +1075,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -1116,7 +1097,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -1214,7 +1194,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -1242,7 +1221,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -1267,7 +1245,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -1289,7 +1266,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -1496,7 +1472,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -1616,7 +1591,6 @@ Err( input: [ 122, ], - kind: Fail, }, ), ) @@ -1831,7 +1805,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -2173,7 +2146,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -2285,7 +2257,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -2677,7 +2648,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -2792,7 +2762,6 @@ Err( 116, 121, ], - kind: Fail, }, ), ) @@ -2817,7 +2786,6 @@ Err( Backtrack( InputError { input: "cd", - kind: Fail, }, ), ) @@ -2832,7 +2800,6 @@ Err( Backtrack( InputError { input: "cd", - kind: Fail, }, ), ) @@ -2907,7 +2874,6 @@ Err( Backtrack( InputError { input: "abcd", - kind: Fail, }, ), ) @@ -2969,7 +2935,6 @@ Err( 101, 102, ], - kind: Fail, }, ), ) @@ -3005,7 +2970,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -3243,7 +3207,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -3274,7 +3237,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -3302,7 +3264,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -3725,7 +3686,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -3781,7 +3741,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -4076,7 +4035,6 @@ Err( 108, 111, ], - kind: Fail, }, ), ) diff --git a/src/error.rs b/src/error.rs index a51668b7..277659cc 100644 --- a/src/error.rs +++ b/src/error.rs @@ -267,7 +267,6 @@ where E: FromExternalError, { #[inline(always)] - #[allow(deprecated)] fn from_external_error(input: &I, e: EXT) -> Self { ErrMode::Backtrack(E::from_external_error(input, e)) } @@ -304,14 +303,10 @@ impl ErrMode> { { match self { ErrMode::Incomplete(n) => ErrMode::Incomplete(n), - ErrMode::Cut(InputError { input, kind }) => ErrMode::Cut(InputError { - input: f(input), - kind, - }), - ErrMode::Backtrack(InputError { input, kind }) => ErrMode::Backtrack(InputError { - input: f(input), - kind, - }), + ErrMode::Cut(InputError { input }) => ErrMode::Cut(InputError { input: f(input) }), + ErrMode::Backtrack(InputError { input }) => { + ErrMode::Backtrack(InputError { input: f(input) }) + } } } } @@ -460,7 +455,6 @@ pub trait FromRecoverableError { /// This trait is required by the [`Parser::try_map`] combinator. pub trait FromExternalError { /// Like [`ParserError::from_input`] but also include an external error. - #[allow(deprecated)] fn from_external_error(input: &I, e: E) -> Self; } @@ -482,23 +476,16 @@ pub trait ErrorConvert { /// /// #[derive(Copy, Clone, Debug, Eq, PartialEq)] -#[allow(deprecated)] pub struct InputError { /// The input stream, pointing to the location where the error occurred pub input: I, - /// A rudimentary error kind - pub kind: ErrorKind, } impl InputError { /// Creates a new basic error #[inline] pub fn at(input: I) -> Self { - #[allow(deprecated)] - Self { - input, - kind: ErrorKind::Fail, - } + Self { input } } /// Translate the input type @@ -506,7 +493,6 @@ impl InputError { pub fn map_input I2>(self, op: O) -> InputError { InputError { input: op(self.input), - kind: self.kind, } } } @@ -527,10 +513,8 @@ impl ParserError for InputError { #[inline] fn from_input(input: &I) -> Self { - #[allow(deprecated)] Self { input: input.clone(), - kind: ErrorKind::Fail, } } @@ -559,11 +543,9 @@ impl FromRecoverableError for InputError { impl FromExternalError for InputError { /// Create a new error from an input position and an external error #[inline] - #[allow(deprecated)] fn from_external_error(input: &I, _e: E) -> Self { Self { input: input.clone(), - kind: ErrorKind::Fail, } } } @@ -585,12 +567,7 @@ impl ErrorConvert> for InputError<(I, usize)> { /// The Display implementation allows the `std::error::Error` implementation impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!( - f, - "{} error starting at: {}", - self.kind.description(), - self.input - ) + write!(f, "failed to parse starting at: {}", self.input) } } @@ -636,7 +613,6 @@ impl FromRecoverableError for EmptyError { impl FromExternalError for EmptyError { #[inline(always)] - #[allow(deprecated)] fn from_external_error(_input: &I, _e: E) -> Self { Self } @@ -684,7 +660,6 @@ impl FromRecoverableError for () { impl FromExternalError for () { #[inline] - #[allow(deprecated)] fn from_external_error(_input: &I, _e: E) -> Self {} } @@ -794,7 +769,6 @@ impl FromExternalError for ContextError { #[inline] - #[allow(deprecated)] fn from_external_error(_input: &I, e: E) -> Self { let mut err = Self::new(); { @@ -808,7 +782,6 @@ impl FromExternalError #[cfg(not(feature = "std"))] impl FromExternalError for ContextError { #[inline] - #[allow(deprecated)] fn from_external_error(_input: &I, _e: E) -> Self { let err = Self::new(); err @@ -990,9 +963,6 @@ pub enum TreeErrorFrame { pub struct TreeErrorBase { /// Parsed input, at the location where the error occurred pub input: I, - /// Debug context - #[allow(deprecated)] - pub kind: ErrorKind, /// See [`FromExternalError::from_external_error`] pub cause: Option>, } @@ -1022,7 +992,6 @@ impl TreeError { match self { TreeError::Base(base) => TreeError::Base(TreeErrorBase { input: op(base.input), - kind: base.kind, cause: base.cause, }), TreeError::Stack { base, stack } => { @@ -1032,7 +1001,6 @@ impl TreeError { .map(|frame| match frame { TreeErrorFrame::Kind(kind) => TreeErrorFrame::Kind(TreeErrorBase { input: op(kind.input), - kind: kind.kind, cause: kind.cause, }), TreeErrorFrame::Context(context) => { @@ -1073,23 +1041,16 @@ where type Inner = Self; fn from_input(input: &I) -> Self { - #[allow(deprecated)] TreeError::Base(TreeErrorBase { input: input.clone(), - kind: ErrorKind::Fail, cause: None, }) } - #[allow(deprecated)] fn append(self, input: &I, token_start: &::Checkpoint) -> Self { let mut input = input.clone(); input.reset(token_start); - let frame = TreeErrorFrame::Kind(TreeErrorBase { - input, - kind: ErrorKind::Fail, - cause: None, - }); + let frame = TreeErrorFrame::Kind(TreeErrorBase { input, cause: None }); self.append_frame(frame) } @@ -1099,7 +1060,7 @@ where // Just in case an implementation does a divide-and-conquer algorithm // // To prevent mixing `alt`s at different levels, parsers should - // `alt_err.append(input, ErrorKind::Alt)`. + // `alt_err.append(input)`. first.extend(second); TreeError::Alt(first) } @@ -1149,11 +1110,9 @@ impl FromExternalError where I: Clone, { - #[allow(deprecated)] fn from_external_error(input: &I, e: E) -> Self { TreeError::Base(TreeErrorBase { input: input.clone(), - kind: ErrorKind::Fail, cause: Some(Box::new(e)), }) } @@ -1217,9 +1176,6 @@ impl fmt::Display for TreeErrorBase { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { if let Some(cause) = self.cause.as_ref() { write!(f, "caused by {cause}")?; - } else { - let kind = self.kind.description(); - write!(f, "in {kind}")?; } let input = abbreviate(self.input.to_string()); write!(f, " at '{input}'")?; @@ -1273,90 +1229,6 @@ impl fmt::Display for TreeError { } } -/// Deprecated -/// -/// For error typse, use [`EmptyError`] instead -/// -/// For creating an error, use [`ParserError::from_input`], [`InputError::at`] -#[rustfmt::skip] -#[derive(Debug,PartialEq,Eq,Hash,Clone,Copy)] -#[allow(missing_docs)] -#[deprecated(since = "0.6.26")] -pub enum ErrorKind { - Assert, - Token, - Literal, - Alt, - Repeat, - Eof, - Slice, - Complete, - Not, - Verify, - Fail, -} - -#[allow(deprecated)] -impl ErrorKind { - #[rustfmt::skip] - /// Converts an `ErrorKind` to a text description - pub fn description(&self) -> &str { - match *self { - ErrorKind::Assert => "assert", - ErrorKind::Token => "token", - ErrorKind::Literal => "literal", - ErrorKind::Alt => "alternative", - ErrorKind::Repeat => "repeat", - ErrorKind::Eof => "end of file", - ErrorKind::Slice => "slice", - ErrorKind::Complete => "complete", - ErrorKind::Not => "negation", - ErrorKind::Verify => "predicate verification", - ErrorKind::Fail => "fail", - } - } -} - -#[allow(deprecated)] -impl ParserError for ErrorKind { - type Inner = Self; - - #[inline] - fn from_input(_input: &I) -> Self { - Self::Fail - } - - #[inline(always)] - fn into_inner(self) -> Result { - Ok(self) - } -} - -#[allow(deprecated)] -impl AddContext for ErrorKind {} - -#[allow(deprecated)] -impl FromExternalError for ErrorKind { - /// Create a new error from an input position and an external error - #[inline] - #[allow(deprecated)] - fn from_external_error(_input: &I, _e: E) -> Self { - Self::Fail - } -} - -/// The Display implementation allows the `std::error::Error` implementation -#[allow(deprecated)] -impl fmt::Display for ErrorKind { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "error {self:?}") - } -} - -#[cfg(feature = "std")] -#[allow(deprecated)] -impl std::error::Error for ErrorKind {} - /// See [`Parser::parse`] #[derive(Clone, Debug, PartialEq, Eq)] pub struct ParseError { @@ -1523,7 +1395,7 @@ mod test_parse_error { let expected = "\ 0xZ123 ^ -fail error starting at: Z123"; +failed to parse starting at: Z123"; assert_eq!(error.to_string(), expected); } } diff --git a/src/macros/tests.rs b/src/macros/tests.rs index 4b6e6fcd..88114b5a 100644 --- a/src/macros/tests.rs +++ b/src/macros/tests.rs @@ -45,7 +45,6 @@ Err( Backtrack( InputError { input: "rror", - kind: Fail, }, ), ) @@ -60,7 +59,6 @@ Err( Backtrack( InputError { input: "", - kind: Fail, }, ), ) @@ -111,7 +109,6 @@ Err( Backtrack( InputError { input: " remaining", - kind: Fail, }, ), ) @@ -126,7 +123,6 @@ Err( Backtrack( InputError { input: "", - kind: Fail, }, ), ) @@ -180,7 +176,6 @@ Err( Backtrack( InputError { input: " remaining", - kind: Fail, }, ), ) @@ -195,7 +190,6 @@ Err( Backtrack( InputError { input: "", - kind: Fail, }, ), ) @@ -396,7 +390,6 @@ Err( Backtrack( InputError { input: " remaining", - kind: Fail, }, ), ) @@ -411,7 +404,6 @@ Err( Backtrack( InputError { input: "", - kind: Fail, }, ), ) @@ -515,7 +507,6 @@ Err( Backtrack( InputError { input: " remaining", - kind: Fail, }, ), ) @@ -530,7 +521,6 @@ Err( Backtrack( InputError { input: "", - kind: Fail, }, ), ) diff --git a/src/parser.rs b/src/parser.rs index bd2b1db5..2128129d 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -1318,7 +1318,6 @@ Err( Backtrack( InputError { input: "123def", - kind: Fail, }, ), ) @@ -1407,7 +1406,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) diff --git a/src/token/tests.rs b/src/token/tests.rs index a8ebcbbd..c747f1f2 100644 --- a/src/token/tests.rs +++ b/src/token/tests.rs @@ -90,7 +90,6 @@ Err( Backtrack( InputError { input: "end", - kind: Fail, }, ), ) @@ -105,7 +104,6 @@ Err( Backtrack( InputError { input: "1234end", - kind: Fail, }, ), ) @@ -159,7 +157,6 @@ Err( Backtrack( InputError { input: "123456789end", - kind: Fail, }, ), ) @@ -286,7 +283,6 @@ Err( 97, 98, ], - kind: Fail, }, ), ) @@ -307,7 +303,6 @@ Err( 108, 111, ], - kind: Fail, }, ), ) @@ -326,7 +321,6 @@ Err( 101, 108, ], - kind: Fail, }, ), ) @@ -384,7 +378,6 @@ Err( Backtrack( InputError { input: "ab", - kind: Fail, }, ), ) @@ -399,7 +392,6 @@ Err( Backtrack( InputError { input: "Hello", - kind: Fail, }, ), ) @@ -414,7 +406,6 @@ Err( Backtrack( InputError { input: "Hel", - kind: Fail, }, ), ) @@ -433,7 +424,6 @@ Err( Backtrack( InputError { input: "K", - kind: Fail, }, ), ) @@ -452,7 +442,6 @@ Err( Backtrack( InputError { input: "k", - kind: Fail, }, ), ) @@ -540,7 +529,6 @@ Err( 65, 0, ], - kind: Fail, }, ), ) @@ -582,7 +570,6 @@ Err( 65, 0, ], - kind: Fail, }, ), ) @@ -656,7 +643,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -695,7 +681,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -743,7 +728,6 @@ Err( input: "abcd", partial: true, }, - kind: Fail, }, ), ) @@ -793,7 +777,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -894,7 +877,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -1000,7 +982,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -1525,7 +1506,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -1650,7 +1630,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -1785,7 +1764,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -2505,7 +2483,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -2527,7 +2504,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -2611,7 +2587,6 @@ Err( input: "Hello", partial: true, }, - kind: Fail, }, ), ) @@ -2629,7 +2604,6 @@ Err( input: "Hel", partial: true, }, - kind: Fail, }, ), ) @@ -2651,7 +2625,6 @@ Err( input: "K", partial: true, }, - kind: Fail, }, ), ) @@ -2673,7 +2646,6 @@ Err( input: "k", partial: true, }, - kind: Fail, }, ), ) diff --git a/tests/testsuite/issues.rs b/tests/testsuite/issues.rs index 72504b4b..7bebdb72 100644 --- a/tests/testsuite/issues.rs +++ b/tests/testsuite/issues.rs @@ -334,7 +334,6 @@ Err( Backtrack( InputError { input: "bbb", - kind: Fail, }, ), ) @@ -477,7 +476,6 @@ Err( input: [ 44, ], - kind: Fail, }, ), ) diff --git a/tests/testsuite/utf8.rs b/tests/testsuite/utf8.rs index 41b38cf4..7cc732ba 100644 --- a/tests/testsuite/utf8.rs +++ b/tests/testsuite/utf8.rs @@ -43,7 +43,6 @@ Err( Backtrack( InputError { input: "Hello", - kind: Fail, }, ), ) @@ -64,7 +63,6 @@ Err( Backtrack( InputError { input: "Hello World!", - kind: Fail, }, ), ) @@ -416,7 +414,6 @@ Err( input: "123", partial: true, }, - kind: Fail, }, ), ) @@ -492,7 +489,6 @@ Err( Backtrack( InputError { input: "βèƒôřèÂßÇáƒƭèř", - kind: Fail, }, ), ) @@ -516,7 +512,6 @@ Err( Backtrack( InputError { input: "βèƒôřèÂßÇáƒƭèř", - kind: Fail, }, ), ) @@ -586,7 +581,6 @@ Err( Backtrack( InputError { input: "βèƒôřèÂßÇáƒƭèř", - kind: Fail, }, ), ) From 41a4237ad2c31b4c6e58cecb623ae0255c5d85f9 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 29 Jan 2025 15:20:21 -0600 Subject: [PATCH 16/16] chore: Remove unused allows --- examples/custom_error.rs | 2 -- src/combinator/branch.rs | 4 ---- src/combinator/impls.rs | 1 - src/combinator/multi.rs | 18 ------------------ src/combinator/tests.rs | 4 ---- tests/testsuite/custom_errors.rs | 3 --- 6 files changed, 32 deletions(-) diff --git a/examples/custom_error.rs b/examples/custom_error.rs index 561920b7..8d5fb072 100644 --- a/examples/custom_error.rs +++ b/examples/custom_error.rs @@ -18,7 +18,6 @@ pub enum CustomError { impl ParserError for CustomError { type Inner = Self; - #[allow(deprecated)] fn from_input(input: &I) -> Self { CustomError::Winnow(input.clone()) } @@ -44,7 +43,6 @@ impl FromExtern for CustomError { #[inline] - #[allow(deprecated)] fn from_external_error(input: &I, e: E) -> Self { CustomError::External { cause: Box::new(e), diff --git a/src/combinator/branch.rs b/src/combinator/branch.rs index 5d3c01a1..5ad2cd88 100644 --- a/src/combinator/branch.rs +++ b/src/combinator/branch.rs @@ -144,7 +144,6 @@ impl, P: Parser> Alt Err(e.append(input, &start)), None => Err(ParserError::assert( @@ -173,7 +172,6 @@ impl, P: Parser> Alt for &mut } } - #[allow(deprecated)] match error { Some(e) => Err(e.append(input, &start)), None => Err(ParserError::assert( @@ -253,7 +251,6 @@ macro_rules! alt_trait_inner( } }); ($it:tt, $self:expr, $input:expr, $start:ident, $err:expr, $head:ident) => ({ - #[allow(deprecated)] Err($err.append($input, &$start)) }); ); @@ -307,7 +304,6 @@ macro_rules! permutation_trait_impl( if let Some(err) = err { // There are remaining parsers, and all errored on the remaining input input.reset(&start); -#[allow(deprecated)] return Err(err.append(input, &start)); } diff --git a/src/combinator/impls.rs b/src/combinator/impls.rs index c4cef40f..4b199e9c 100644 --- a/src/combinator/impls.rs +++ b/src/combinator/impls.rs @@ -94,7 +94,6 @@ where let o = self.parser.parse_next(input)?; let res = (self.map)(o).map_err(|err| { input.reset(&start); - #[allow(deprecated)] E::from_external_error(input, err) }); trace_result("verify", &res); diff --git a/src/combinator/multi.rs b/src/combinator/multi.rs index 89eb54e7..107e23f6 100644 --- a/src/combinator/multi.rs +++ b/src/combinator/multi.rs @@ -497,7 +497,6 @@ where E: ParserError, { let start = i.checkpoint(); - #[allow(deprecated)] match f.parse_next(i) { Err(e) => Err(e.append(i, &start)), Ok(o) => { @@ -555,7 +554,6 @@ where res.accumulate(o); } Err(e) => { - #[allow(deprecated)] return Err(e.append(i, &start)); } } @@ -596,7 +594,6 @@ where } Err(e) if e.is_backtrack() => { if count < min { - #[allow(deprecated)] return Err(e.append(input, &start)); } else { input.reset(&start); @@ -693,7 +690,6 @@ where Ok(o) => return Ok((res, o)), Err(e) if e.is_backtrack() => { i.reset(&start); - #[allow(deprecated)] match f.parse_next(i) { Err(e) => return Err(e.append(i, &start)), Ok(o) => { @@ -744,7 +740,6 @@ where res.accumulate(o); } Err(e) => { - #[allow(deprecated)] return Err(e.append(i, &start)); } } @@ -761,7 +756,6 @@ where i.reset(&start); match f.parse_next(i) { Err(e) => { - #[allow(deprecated)] return Err(e.append(i, &start)); } Ok(o) => { @@ -1053,7 +1047,6 @@ where let start = input.checkpoint(); match parser.parse_next(input) { Err(e) => { - #[allow(deprecated)] return Err(e.append(input, &start)); } Ok(o) => { @@ -1066,7 +1059,6 @@ where let len = input.eof_offset(); match separator.parse_next(input) { Err(e) => { - #[allow(deprecated)] return Err(e.append(input, &start)); } Ok(_) => { @@ -1080,7 +1072,6 @@ where match parser.parse_next(input) { Err(e) => { - #[allow(deprecated)] return Err(e.append(input, &start)); } Ok(o) => { @@ -1124,7 +1115,6 @@ where input.reset(&start); return Ok(acc); } else { - #[allow(deprecated)] return Err(e.append(input, &start)); } } @@ -1140,7 +1130,6 @@ where match separator.parse_next(input) { Err(e) if e.is_backtrack() => { if index < min { - #[allow(deprecated)] return Err(e.append(input, &start)); } else { input.reset(&start); @@ -1162,7 +1151,6 @@ where match parser.parse_next(input) { Err(e) if e.is_backtrack() => { if index < min { - #[allow(deprecated)] return Err(e.append(input, &start)); } else { input.reset(&start); @@ -1345,7 +1333,6 @@ where *elem = o; } Err(e) => { - #[allow(deprecated)] return Err(e.append(i, &start)); } } @@ -1411,7 +1398,6 @@ where { let init = init(); let start = input.checkpoint(); - #[allow(deprecated)] match f.parse_next(input) { Err(e) => Err(e.append(input, &start)), Ok(o1) => { @@ -1486,7 +1472,6 @@ where //FInputXMError: handle failure properly Err(err) if err.is_backtrack() => { if count < min { - #[allow(deprecated)] return Err(err.append(input, &start)); } else { input.reset(&start); @@ -1548,7 +1533,6 @@ where //FInputXMError: handle failure properly Err(err) if err.is_backtrack() => { if count < min { - #[allow(deprecated)] return Err(err.append(input, &start)); } else { input.reset(&start); @@ -1603,7 +1587,6 @@ where Ok(tmp) => acc = tmp, Err(e) => { input.reset(&start); - #[allow(deprecated)] let res = Err(E::from_external_error(input, e)); super::debug::trace_result("try_fold", &res); return res; @@ -1613,7 +1596,6 @@ where //FInputXMError: handle failure properly Err(err) if err.is_backtrack() => { if count < min { - #[allow(deprecated)] return Err(err.append(input, &start)); } else { input.reset(&start); diff --git a/src/combinator/tests.rs b/src/combinator/tests.rs index 5c97cdeb..fc1659e5 100644 --- a/src/combinator/tests.rs +++ b/src/combinator/tests.rs @@ -118,7 +118,6 @@ impl From for CustomError { impl ParserError for CustomError { type Inner = Self; - #[allow(deprecated)] fn from_input(_: &I) -> Self { CustomError } @@ -1306,12 +1305,10 @@ fn alt_test() { impl ParserError for ErrorStr { type Inner = Self; - #[allow(deprecated)] fn from_input(input: &I) -> Self { ErrorStr(format!("custom error message: ({input:?})")) } - #[allow(deprecated)] fn append(self, input: &I, _: &::Checkpoint) -> Self { ErrorStr(format!("custom error message: ({input:?}) - {self:?}")) } @@ -3426,7 +3423,6 @@ struct NilError; impl ParserError for NilError { type Inner = Self; - #[allow(deprecated)] fn from_input(_: &I) -> NilError { NilError } diff --git a/tests/testsuite/custom_errors.rs b/tests/testsuite/custom_errors.rs index b860643c..868b7eaf 100644 --- a/tests/testsuite/custom_errors.rs +++ b/tests/testsuite/custom_errors.rs @@ -4,7 +4,6 @@ use winnow::ascii::digit1 as digit; #[cfg(feature = "alloc")] use winnow::combinator::repeat; use winnow::combinator::terminated; -#[allow(deprecated)] use winnow::error::ParserError; use winnow::prelude::*; use winnow::stream::Stream; @@ -16,12 +15,10 @@ pub(crate) struct CustomError(String); impl<'a> ParserError> for CustomError { type Inner = Self; - #[allow(deprecated)] fn from_input(_: &Partial<&'a str>) -> Self { CustomError("error".to_owned()) } - #[allow(deprecated)] fn append(self, _: &Partial<&'a str>, _: & as Stream>::Checkpoint) -> Self { self }