Skip to content

Commit

Permalink
refactor: Move off of deprecated 'trace' path
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Jan 25, 2024
1 parent d624d46 commit bc1c103
Show file tree
Hide file tree
Showing 13 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/ascii/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ use crate::lib::std::ops::{Add, Shl};
use crate::combinator::alt;
use crate::combinator::cut_err;
use crate::combinator::opt;
use crate::combinator::trace;
use crate::error::ParserError;
use crate::error::{ErrMode, ErrorKind, Needed};
use crate::stream::{AsBStr, AsChar, ParseSlice, Stream, StreamIsPartial};
use crate::stream::{Compare, CompareResult};
use crate::token::one_of;
use crate::token::take_till;
use crate::token::take_while;
use crate::trace::trace;
use crate::PResult;
use crate::Parser;

Expand Down
2 changes: 1 addition & 1 deletion src/binary/bits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
#[cfg(test)]
mod tests;

use crate::combinator::trace;
use crate::error::{ErrMode, ErrorConvert, ErrorKind, Needed, ParserError};
use crate::lib::std::ops::{AddAssign, Div, Shl, Shr};
use crate::stream::{AsBytes, Stream, StreamIsPartial, ToUsize};
use crate::trace::trace;
use crate::{unpeek, IResult, PResult, Parser};

/// Number of bits in a byte
Expand Down
2 changes: 1 addition & 1 deletion src/binary/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pub mod bits;
mod tests;

use crate::combinator::repeat;
use crate::combinator::trace;
use crate::error::ErrMode;
use crate::error::ErrorKind;
use crate::error::Needed;
Expand All @@ -17,7 +18,6 @@ use crate::stream::Accumulate;
use crate::stream::{AsBytes, Stream, StreamIsPartial};
use crate::stream::{ToUsize, UpdateSlice};
use crate::token::take;
use crate::trace::trace;
use crate::PResult;
use crate::Parser;

Expand Down
2 changes: 1 addition & 1 deletion src/combinator/branch.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::combinator::trace;
use crate::error::{ErrMode, ErrorKind, ParserError};
use crate::stream::Stream;
use crate::trace::trace;
use crate::*;

#[doc(inline)]
Expand Down
2 changes: 1 addition & 1 deletion src/combinator/core.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::combinator::trace;
use crate::error::{ErrMode, ErrorKind, Needed, ParserError};
use crate::stream::Stream;
use crate::trace::trace;
use crate::*;

/// Return the remaining input.
Expand Down
2 changes: 1 addition & 1 deletion src/combinator/debug/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ compile_error!("`debug` requires `std`");
/// # use winnow::token::take_while;
/// # use winnow::stream::AsChar;
/// # use winnow::prelude::*;
/// use winnow::trace::trace;
/// use winnow::combinator::trace;
///
/// fn short_alpha<'s>(s: &mut &'s [u8]) -> PResult<&'s [u8], InputError<&'s [u8]>> {
/// trace("short_alpha",
Expand Down
2 changes: 1 addition & 1 deletion src/combinator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
//! - [`backtrack_err`]: Attempts a parse, allowing alternative parsers to be attempted despite
//! use of `cut_err`
//! - [`Parser::context`]: Add context to the error if the parser fails
//! - [`trace`][crate::trace::trace]: Print the parse state with the `debug` feature flag
//! - [`trace`]: Print the parse state with the `debug` feature flag
//! - [`todo()`]: Placeholder parser
//!
//! ## Remaining combinators
Expand Down
2 changes: 1 addition & 1 deletion src/combinator/multi.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
//! Combinators applying their child parser multiple times
use crate::combinator::trace;
use crate::error::ErrMode;
use crate::error::ErrorKind;
use crate::error::ParserError;
use crate::stream::Accumulate;
use crate::stream::Range;
use crate::stream::Stream;
use crate::trace::trace;
use crate::PResult;
use crate::Parser;

Expand Down
2 changes: 1 addition & 1 deletion src/combinator/parser.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use crate::combinator::trace;
use crate::combinator::trace_result;
use crate::error::{AddContext, ErrMode, ErrorKind, FromExternalError, ParserError};
use crate::lib::std::borrow::Borrow;
use crate::lib::std::ops::Range;
use crate::stream::StreamIsPartial;
use crate::stream::{Location, Stream};
use crate::trace::trace;
use crate::*;

/// Implementation of [`Parser::by_ref`]
Expand Down
2 changes: 1 addition & 1 deletion src/combinator/sequence.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::combinator::trace;
use crate::error::ParserError;
use crate::stream::Stream;
use crate::trace::trace;
use crate::*;

#[doc(inline)]
Expand Down
2 changes: 1 addition & 1 deletion src/macros/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#[doc(hidden)] // forced to be visible in intended location
macro_rules! dispatch {
($match_parser: expr; $( $pat:pat $(if $pred:expr)? => $expr: expr ),+ $(,)? ) => {
$crate::trace::trace("dispatch", move |i: &mut _|
$crate::combinator::trace("dispatch", move |i: &mut _|
{
use $crate::Parser;
let initial = $match_parser.parse_next(i)?;
Expand Down
6 changes: 3 additions & 3 deletions src/macros/seq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@
#[doc(alias = "struct_parser")]
macro_rules! seq {
($name: ident { $($fields: tt)* }) => {
$crate::trace::trace(stringify!($name), move |input: &mut _| {
$crate::combinator::trace(stringify!($name), move |input: &mut _| {
use $crate::Parser;
$crate::seq_parse_struct_fields!(input; $($fields)*);
#[allow(clippy::redundant_field_names)]
Ok($crate::seq_init_struct_fields!( ($($fields)*); $name;))
})
};
($name: ident ( $($elements: tt)* )) => {
$crate::trace::trace(stringify!($name), move |input: &mut _| {
$crate::combinator::trace(stringify!($name), move |input: &mut _| {
use $crate::Parser;
$crate::seq_parse_tuple_fields!( ($($elements)*) ; ).map(|t| {
$crate::seq_init_tuple_fields!(
Expand All @@ -84,7 +84,7 @@ macro_rules! seq {
})
};
(( $($elements: tt)* )) => {
$crate::trace::trace("tuple", move |input: &mut _| {
$crate::combinator::trace("tuple", move |input: &mut _| {
use $crate::Parser;
$crate::seq_parse_tuple_fields!( ($($elements)*) ; ).map(|t| {
$crate::seq_init_tuple_fields!(
Expand Down
2 changes: 1 addition & 1 deletion src/token/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#[cfg(test)]
mod tests;

use crate::combinator::trace;
use crate::error::ErrMode;
use crate::error::ErrorKind;
use crate::error::Needed;
Expand All @@ -11,7 +12,6 @@ use crate::lib::std::result::Result::Ok;
use crate::stream::Range;
use crate::stream::{Compare, CompareResult, ContainsToken, FindSlice, SliceLen, Stream};
use crate::stream::{StreamIsPartial, ToUsize};
use crate::trace::trace;
use crate::PResult;
use crate::Parser;

Expand Down

0 comments on commit bc1c103

Please sign in to comment.