Skip to content

Commit

Permalink
chore: Remove unused allows
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Jan 29, 2025
1 parent 3e6d450 commit fd3f486
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 32 deletions.
2 changes: 0 additions & 2 deletions examples/custom_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ pub enum CustomError<I> {
impl<I: Stream + Clone> ParserError<I> for CustomError<I> {
type Inner = Self;

#[allow(deprecated)]
fn from_input(input: &I) -> Self {
CustomError::Winnow(input.clone())
}
Expand All @@ -44,7 +43,6 @@ impl<I: Stream + Clone, E: std::error::Error + Send + Sync + 'static> FromExtern
for CustomError<I>
{
#[inline]
#[allow(deprecated)]
fn from_external_error(input: &I, e: E) -> Self {
CustomError::External {
cause: Box::new(e),
Expand Down
4 changes: 0 additions & 4 deletions src/combinator/branch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ impl<const N: usize, I: Stream, O, E: ParserError<I>, P: Parser<I, O, E>> Alt<I,
}
}

#[allow(deprecated)]
match error {
Some(e) => Err(e.append(input, &start)),
None => Err(ParserError::assert(
Expand Down Expand Up @@ -173,7 +172,6 @@ impl<I: Stream, O, E: ParserError<I>, P: Parser<I, O, E>> Alt<I, O, E> for &mut
}
}

#[allow(deprecated)]
match error {
Some(e) => Err(e.append(input, &start)),
None => Err(ParserError::assert(
Expand Down Expand Up @@ -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))
});
);
Expand Down Expand Up @@ -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));
}

Expand Down
1 change: 0 additions & 1 deletion src/combinator/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
18 changes: 0 additions & 18 deletions src/combinator/multi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,6 @@ where
E: ParserError<I>,
{
let start = i.checkpoint();
#[allow(deprecated)]
match f.parse_next(i) {
Err(e) => Err(e.append(i, &start)),
Ok(o) => {
Expand Down Expand Up @@ -555,7 +554,6 @@ where
res.accumulate(o);
}
Err(e) => {
#[allow(deprecated)]
return Err(e.append(i, &start));
}
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -744,7 +740,6 @@ where
res.accumulate(o);
}
Err(e) => {
#[allow(deprecated)]
return Err(e.append(i, &start));
}
}
Expand All @@ -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) => {
Expand Down Expand Up @@ -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) => {
Expand All @@ -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(_) => {
Expand All @@ -1080,7 +1072,6 @@ where

match parser.parse_next(input) {
Err(e) => {
#[allow(deprecated)]
return Err(e.append(input, &start));
}
Ok(o) => {
Expand Down Expand Up @@ -1124,7 +1115,6 @@ where
input.reset(&start);
return Ok(acc);
} else {
#[allow(deprecated)]
return Err(e.append(input, &start));
}
}
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -1345,7 +1333,6 @@ where
*elem = o;
}
Err(e) => {
#[allow(deprecated)]
return Err(e.append(i, &start));
}
}
Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down
4 changes: 0 additions & 4 deletions src/combinator/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ impl From<u32> for CustomError {
impl<I: Stream> ParserError<I> for CustomError {
type Inner = Self;

#[allow(deprecated)]
fn from_input(_: &I) -> Self {
CustomError
}
Expand Down Expand Up @@ -1306,12 +1305,10 @@ fn alt_test() {
impl<I: Stream + Debug> ParserError<I> 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, _: &<I as Stream>::Checkpoint) -> Self {
ErrorStr(format!("custom error message: ({input:?}) - {self:?}"))
}
Expand Down Expand Up @@ -3426,7 +3423,6 @@ struct NilError;
impl<I: Stream> ParserError<I> for NilError {
type Inner = Self;

#[allow(deprecated)]
fn from_input(_: &I) -> NilError {
NilError
}
Expand Down
3 changes: 0 additions & 3 deletions tests/testsuite/custom_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -16,12 +15,10 @@ pub(crate) struct CustomError(String);
impl<'a> ParserError<Partial<&'a str>> for CustomError {
type Inner = Self;

#[allow(deprecated)]
fn from_input(_: &Partial<&'a str>) -> Self {
CustomError(format!("error"))

Check warning

Code scanning / clippy

useless use of format! Warning test

useless use of format!
}

#[allow(deprecated)]
fn append(self, _: &Partial<&'a str>, _: &<Partial<&'a str> as Stream>::Checkpoint) -> Self {
CustomError(format!("{self:?}"))
}
Expand Down

0 comments on commit fd3f486

Please sign in to comment.