Skip to content

Commit

Permalink
refactor: Address warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Dec 30, 2024
1 parent 549d2af commit f5adba6
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 84 deletions.
3 changes: 2 additions & 1 deletion benches/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ fn repeat(input: &mut &[u8]) -> PResult<usize> {
count += winnow::combinator::repeat(0.., one_of(AsChar::is_dec_digit))
.map(|count: usize| count)
.parse_next(input)?;
winnow::combinator::repeat(0.., one_of(|b: u8| !b.is_dec_digit())).parse_next(input)?;
let () =
winnow::combinator::repeat(0.., one_of(|b: u8| !b.is_dec_digit())).parse_next(input)?;
}
Ok(count)
}
Expand Down
4 changes: 2 additions & 2 deletions examples/s_expression/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub(crate) fn eval_from_str(src: &str) -> Result<Expr, String> {

/// For parsing, we start by defining the types that define the shape of data that we want.
/// In this case, we want something tree-like
///
/// The remaining half is Lists. We implement these as recursive Expressions.
/// For a list of numbers, we have `'(1 2 3)`, which we'll parse to:
/// ```
Expand Down Expand Up @@ -242,7 +242,7 @@ where
/// a little interpreter to take an Expr, which is really an
/// [Abstract Syntax Tree](https://en.wikipedia.org/wiki/Abstract_syntax_tree) (AST),
/// and give us something back
///
/// This function tries to reduce the AST.
/// This has to return an Expression rather than an Atom because quoted `s_expressions`
/// can't be reduced
Expand Down
2 changes: 1 addition & 1 deletion src/combinator/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ where
}
}

impl<'a, F, I, O, E> core::iter::Iterator for &'a mut ParserIterator<F, I, O, E>
impl<F, I, O, E> core::iter::Iterator for &mut ParserIterator<F, I, O, E>
where
F: Parser<I, O, E>,
I: Stream,
Expand Down
2 changes: 1 addition & 1 deletion src/combinator/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl<'p, P> ByRef<'p, P> {
}
}

impl<'p, I, O, E, P> Parser<I, O, E> for ByRef<'p, P>
impl<I, O, E, P> Parser<I, O, E> for ByRef<'_, P>
where
P: Parser<I, O, E>,
{
Expand Down
2 changes: 1 addition & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ impl<I: Clone> InputError<I> {
}

#[cfg(feature = "alloc")]
impl<'i, I: ToOwned> InputError<&'i I>
impl<I: ToOwned> InputError<&I>
where
<I as ToOwned>::Owned: Clone,
{
Expand Down
6 changes: 3 additions & 3 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -743,9 +743,9 @@ pub trait Parser<I, O, E> {
}
}

impl<'a, I, O, E, F> Parser<I, O, E> for F
impl<I, O, E, F> Parser<I, O, E> for F
where
F: FnMut(&mut I) -> PResult<O, E> + 'a,
F: FnMut(&mut I) -> PResult<O, E>,
I: Stream,
{
#[inline(always)]
Expand Down Expand Up @@ -1128,7 +1128,7 @@ impl_parser_for_tuples!(
use crate::lib::std::boxed::Box;

#[cfg(feature = "alloc")]
impl<'a, I, O, E> Parser<I, O, E> for Box<dyn Parser<I, O, E> + 'a> {
impl<I, O, E> Parser<I, O, E> for Box<dyn Parser<I, O, E> + '_> {
#[inline(always)]
fn parse_next(&mut self, i: &mut I) -> PResult<O, E> {
(**self).parse_next(i)
Expand Down
8 changes: 4 additions & 4 deletions src/stream/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ mod bytes {
#[test]
fn test_pretty_debug() {
// Output can change from run-to-run
format!(
let _ = format!(
"{:#?}",
Bytes::new(b"\0\0\0 ftypisom\0\0\x02\0isomiso2avc1mp")
);
Expand All @@ -297,9 +297,9 @@ mod bytes {
fn test_sliced() {
// Output can change from run-to-run
let total = Bytes::new(b"12345678901234567890");
format!("{total:#?}");
format!("{:#?}", &total[1..]);
format!("{:#?}", &total[10..]);
let _ = format!("{total:#?}");
let _ = format!("{:#?}", &total[1..]);
let _ = format!("{:#?}", &total[10..]);
}
}
}
Expand Down
Loading

0 comments on commit f5adba6

Please sign in to comment.