Skip to content

Commit

Permalink
do not require PartialEq on results in permutation
Browse files Browse the repository at this point in the history
  • Loading branch information
Geal committed Mar 26, 2018
1 parent 2943ae5 commit 77405b9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/branch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ macro_rules! permutation_iterator (
use ::std::option::Option::*;
use $crate::Err;

if acc!($it, $res) == None {
if acc!($it, $res).is_none() {
match $submac!($i, $($args)*) {
Ok((i,o)) => {
$i = i;
Expand Down Expand Up @@ -831,7 +831,7 @@ macro_rules! permutation_iterator (
use ::std::option::Option::*;
use $crate::Err;

if acc!($it, $res) == None {
if acc!($it, $res).is_none() {
match $submac!($i, $($args)*) {
Ok((i,o)) => {
$i = i;
Expand Down
15 changes: 15 additions & 0 deletions tests/issues.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,3 +234,18 @@ fn issue_721() {
named!(issue_717<&[u8], Vec<&[u8]> >,
separated_list!(tag!([0x0]), is_not!([0x0u8]))
);

struct NoPartialEq {
value: i32
}

named!(issue_724<&str, i32>,
do_parse!(
metadata: permutation!(
map!(tag!("hello"), |_| NoPartialEq { value: 1 }),
map!(tag!("world"), |_| NoPartialEq { value: 2 })
) >>
(metadata.0.value + metadata.1.value)
)
);

0 comments on commit 77405b9

Please sign in to comment.