diff --git a/examples/custom_error.rs b/examples/custom_error.rs index a4f9234c..8d5fb072 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::*; @@ -20,8 +18,7 @@ pub enum CustomError { 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()) } @@ -46,8 +43,7 @@ impl FromExtern for CustomError { #[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/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, 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/branch.rs b/src/combinator/branch.rs index 651908de..5ad2cd88 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::*; @@ -146,9 +144,8 @@ 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", @@ -175,9 +172,8 @@ 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", @@ -255,8 +251,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)) }); ); @@ -309,8 +304,7 @@ 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, ErrorKind::Alt)); + return Err(err.append(input, &start)); } // All parsers were applied diff --git a/src/combinator/core.rs b/src/combinator/core.rs index 0e8f0329..2c77c6fc 100644 --- a/src/combinator/core.rs +++ b/src/combinator/core.rs @@ -3,28 +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] -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`]. diff --git a/src/combinator/impls.rs b/src/combinator/impls.rs index fae6de1b..4b199e9c 100644 --- a/src/combinator/impls.rs +++ b/src/combinator/impls.rs @@ -94,8 +94,7 @@ 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, crate::error::ErrorKind::Verify, err) + E::from_external_error(input, err) }); trace_result("verify", &res); res @@ -376,10 +375,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 @@ -412,10 +407,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/combinator/mod.rs b/src/combinator/mod.rs index a7f540c5..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 @@ -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::*; diff --git a/src/combinator/multi.rs b/src/combinator/multi.rs index 7d4b592c..107e23f6 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; @@ -499,9 +497,8 @@ where E: ParserError, { 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); @@ -557,8 +554,7 @@ where res.accumulate(o); } Err(e) => { - #[allow(deprecated)] - return Err(e.append(i, &start, ErrorKind::Repeat)); + return Err(e.append(i, &start)); } } } @@ -598,8 +594,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); @@ -695,9 +690,8 @@ 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, 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 { @@ -746,8 +740,7 @@ where res.accumulate(o); } Err(e) => { - #[allow(deprecated)] - return Err(e.append(i, &start, ErrorKind::Repeat)); + return Err(e.append(i, &start)); } } } @@ -763,8 +756,7 @@ where i.reset(&start); 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 @@ -1055,8 +1047,7 @@ where let start = input.checkpoint(); 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); @@ -1068,8 +1059,7 @@ where let len = input.eof_offset(); 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 @@ -1082,8 +1072,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); @@ -1126,8 +1115,7 @@ where input.reset(&start); 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), @@ -1142,8 +1130,7 @@ where match separator.parse_next(input) { 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); @@ -1164,8 +1151,7 @@ where match parser.parse_next(input) { 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); @@ -1347,8 +1333,7 @@ where *elem = o; } Err(e) => { - #[allow(deprecated)] - return Err(e.append(i, &start, ErrorKind::Repeat)); + return Err(e.append(i, &start)); } } } @@ -1413,9 +1398,8 @@ where { let init = init(); 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); @@ -1488,8 +1472,7 @@ where //FInputXMError: handle failure properly 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; @@ -1550,8 +1533,7 @@ where //FInputXMError: handle failure properly 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; @@ -1605,8 +1587,7 @@ where Ok(tmp) => acc = tmp, 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; } @@ -1615,8 +1596,7 @@ where //FInputXMError: handle failure properly 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 6926c047..fc1659e5 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, }, ), ) @@ -120,8 +118,7 @@ impl From for CustomError { impl ParserError for CustomError { type Inner = Self; - #[allow(deprecated)] - fn from_error_kind(_: &I, _: crate::error::ErrorKind) -> Self { + fn from_input(_: &I) -> Self { CustomError } @@ -181,7 +178,6 @@ Err( input: [ 50, ], - kind: Fail, }, ), ) @@ -395,7 +391,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -425,7 +420,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -510,7 +504,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -583,7 +576,6 @@ Err( 102, 103, ], - kind: Fail, }, ), ) @@ -638,7 +630,6 @@ Err( 102, 103, ], - kind: Fail, }, ), ) @@ -660,7 +651,6 @@ Err( Backtrack( InputError { input: "string", - kind: Fail, }, ), ) @@ -675,7 +665,6 @@ Err( Backtrack( InputError { input: "another string", - kind: Fail, }, ), ) @@ -704,7 +693,6 @@ Err( 109, 110, ], - kind: Fail, }, ), ) @@ -799,7 +787,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -825,7 +812,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -847,7 +833,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -933,7 +918,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -959,7 +943,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -981,7 +964,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -1067,7 +1049,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -1093,7 +1074,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -1116,7 +1096,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -1214,7 +1193,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -1242,7 +1220,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -1267,7 +1244,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -1289,7 +1265,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -1330,18 +1305,11 @@ fn alt_test() { impl ParserError for ErrorStr { 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:?})")) } - #[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:?}")) } @@ -1501,7 +1469,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -1621,7 +1588,6 @@ Err( input: [ 122, ], - kind: Fail, }, ), ) @@ -1836,7 +1802,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -2178,7 +2143,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -2290,7 +2254,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -2682,7 +2645,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -2797,7 +2759,6 @@ Err( 116, 121, ], - kind: Fail, }, ), ) @@ -2822,7 +2783,6 @@ Err( Backtrack( InputError { input: "cd", - kind: Fail, }, ), ) @@ -2837,7 +2797,6 @@ Err( Backtrack( InputError { input: "cd", - kind: Fail, }, ), ) @@ -2912,7 +2871,6 @@ Err( Backtrack( InputError { input: "abcd", - kind: Fail, }, ), ) @@ -2974,7 +2932,6 @@ Err( 101, 102, ], - kind: Fail, }, ), ) @@ -3010,7 +2967,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -3248,7 +3204,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -3279,7 +3234,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -3307,7 +3261,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -3470,8 +3423,7 @@ struct NilError; impl ParserError for NilError { type Inner = Self; - #[allow(deprecated)] - fn from_error_kind(_: &I, _: crate::error::ErrorKind) -> NilError { + fn from_input(_: &I) -> NilError { NilError } @@ -3730,7 +3682,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -3786,7 +3737,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) @@ -4081,7 +4031,6 @@ Err( 108, 111, ], - kind: Fail, }, ), ) diff --git a/src/error.rs b/src/error.rs index 8fe7c276..277659cc 100644 --- a/src/error.rs +++ b/src/error.rs @@ -48,14 +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>; - #[cfg(test)] pub(crate) type TestResult = ModalResult>; @@ -189,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)] @@ -208,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, } } @@ -277,9 +267,8 @@ where E: FromExternalError, { #[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)) } } @@ -314,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) }) + } } } } @@ -352,17 +337,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)] @@ -373,7 +349,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 @@ -389,18 +365,12 @@ 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. #[inline] - #[allow(deprecated)] - fn append( - self, - _input: &I, - _token_start: &::Checkpoint, - _kind: ErrorKind, - ) -> Self { + fn append(self, _input: &I, _token_start: &::Checkpoint) -> Self { self } @@ -484,9 +454,8 @@ 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. - #[allow(deprecated)] - fn from_external_error(input: &I, kind: ErrorKind, e: E) -> Self; + /// Like [`ParserError::from_input`] but also include an external error. + fn from_external_error(input: &I, e: E) -> Self; } /// Equivalent of `From` implementation to avoid orphan rules in bits parsers @@ -507,31 +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] - #[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 { - #[allow(deprecated)] - Self { - input, - kind: ErrorKind::Fail, - } + Self { input } } /// Translate the input type @@ -539,7 +493,6 @@ impl InputError { pub fn map_input I2>(self, op: O) -> InputError { InputError { input: op(self.input), - kind: self.kind, } } } @@ -559,11 +512,9 @@ 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 { Self { input: input.clone(), - kind, } } @@ -592,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, kind: ErrorKind, _e: E) -> Self { + fn from_external_error(input: &I, _e: E) -> Self { Self { input: input.clone(), - kind, } } } @@ -618,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) } } @@ -641,8 +585,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 } @@ -670,8 +613,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 } } @@ -693,8 +635,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 { @@ -719,8 +660,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 () { @@ -786,8 +726,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() } @@ -830,8 +769,7 @@ 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 mut err = Self::new(); { err.cause = Some(Box::new(e)); @@ -844,8 +782,7 @@ impl FromExternalError #[cfg(not(feature = "std"))] 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 } @@ -1026,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>, } @@ -1058,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 } => { @@ -1068,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) => { @@ -1108,24 +1040,17 @@ where { type Inner = Self; - #[allow(deprecated)] - fn from_error_kind(input: &I, kind: ErrorKind) -> Self { + fn from_input(input: &I) -> Self { TreeError::Base(TreeErrorBase { input: input.clone(), - kind, cause: None, }) } - #[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, - cause: None, - }); + let frame = TreeErrorFrame::Kind(TreeErrorBase { input, cause: None }); self.append_frame(frame) } @@ -1135,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) } @@ -1185,11 +1110,9 @@ impl FromExternalError 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, cause: Some(Box::new(e)), }) } @@ -1253,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}'")?; @@ -1309,91 +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] - #[allow(deprecated)] - fn from_error_kind(_input: &I, kind: ErrorKind) -> Self { - kind - } - - #[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, kind: ErrorKind, _e: E) -> Self { - kind - } -} - -/// 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 { @@ -1560,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/lib.rs b/src/lib.rs index cd1b8549..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,14 +161,10 @@ pub mod prelude { } pub use error::ModalResult; -#[allow(deprecated)] -pub use error::PResult; 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/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 563a5b0e..2128129d 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 @@ -386,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 @@ -1286,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::*; @@ -1369,7 +1318,6 @@ Err( Backtrack( InputError { input: "123def", - kind: Fail, }, ), ) @@ -1458,7 +1406,6 @@ Err( ], partial: true, }, - kind: Fail, }, ), ) 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, 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/custom_errors.rs b/tests/testsuite/custom_errors.rs index 17646c8c..868b7eaf 100644 --- a/tests/testsuite/custom_errors.rs +++ b/tests/testsuite/custom_errors.rs @@ -4,8 +4,6 @@ use winnow::ascii::digit1 as digit; #[cfg(feature = "alloc")] 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; @@ -17,19 +15,12 @@ pub(crate) struct CustomError(String); 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)] - fn append( - self, - _: &Partial<&'a str>, - _: & as Stream>::Checkpoint, - kind: ErrorKind, - ) -> Self { - CustomError(format!("{self:?}\nerror code was: {kind:?}")) + fn append(self, _: &Partial<&'a str>, _: & as Stream>::Checkpoint) -> Self { + self } fn into_inner(self) -> Result { 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, }, ), )