Skip to content

Commit

Permalink
remove some warnings in tests (#1753)
Browse files Browse the repository at this point in the history
  • Loading branch information
Geal committed May 5, 2024
1 parent dff6cdc commit 1f74da5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
11 changes: 8 additions & 3 deletions src/multi/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use crate::{
character::streaming::digit1 as digit,
error::{ErrorKind, ParseError},
internal::{Err, IResult, Needed},
lib::std::ops::Range,
lib::std::str::{self, FromStr},
number::streaming::{be_u16, be_u8},
sequence::pair,
Expand Down Expand Up @@ -573,7 +572,7 @@ fn many_test() {
);

fn many_invalid(i: &[u8]) -> IResult<&[u8], Vec<&[u8]>> {
many(Range::default(), tag("a")).parse(i)
many(crate::lib::std::ops::Range::default(), tag("a")).parse(i)
}

let a = &b"a"[..];
Expand Down Expand Up @@ -728,7 +727,13 @@ fn fold_test() {
);

fn fold_invalid(i: &[u8]) -> IResult<&[u8], Vec<&[u8]>> {
fold(Range::default(), tag("a"), Vec::new, fold_into_vec).parse(i)
fold(
crate::lib::std::ops::Range::default(),
tag("a"),
Vec::new,
fold_into_vec,
)
.parse(i)
}

let a = &b"a"[..];
Expand Down
3 changes: 1 addition & 2 deletions src/number/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1410,12 +1410,12 @@ where
}

#[cfg(test)]
#[cfg(feature = "std")]
mod tests {
use super::*;
use crate::error::ErrorKind;
use crate::internal::Err;

#[cfg(feature = "std")]
macro_rules! assert_parse(
($left: expr, $right: expr) => {
let res: $crate::IResult<_, _, (_, ErrorKind)> = $left;
Expand All @@ -1424,7 +1424,6 @@ mod tests {
);

#[test]
#[cfg(feature = "std")]
fn float_test() {
let mut test_cases = vec![
"+3.14",
Expand Down
12 changes: 0 additions & 12 deletions src/sequence/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,6 @@ fn single_element_tuples() {
);
}

#[derive(PartialEq, Eq, Debug)]
struct B {
a: u8,
b: u8,
}

#[derive(PartialEq, Eq, Debug)]
struct C {
a: u8,
b: Option<u8>,
}

/*FIXME: convert code examples to new error management
use util::{add_error_pattern, error_to_list, print_error};
Expand Down

0 comments on commit 1f74da5

Please sign in to comment.