Skip to content

Commit

Permalink
Make Debug impl a bit more useful
Browse files Browse the repository at this point in the history
  • Loading branch information
Xaeroxe committed Sep 29, 2020
1 parent 4850993 commit 8d73e8f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/exactly_one_err.rs
Expand Up @@ -73,7 +73,7 @@ where
impl<I> ExactSizeIterator for ExactlyOneError<I> where I: ExactSizeIterator {}

impl<I> Display for ExactlyOneError<I>
where I: Iterator
where I: Iterator,
{
fn fmt(&self, f: &mut Formatter) -> FmtResult {
let additional = self.additional_len();
Expand All @@ -86,25 +86,25 @@ impl<I> Display for ExactlyOneError<I>
}

impl<I> Debug for ExactlyOneError<I>
where I: Iterator,
where I: Iterator + Debug,
I::Item: Debug,
{
fn fmt(&self, f: &mut Formatter) -> FmtResult {
match &self.first_two {
Some(Either::Left([first, second])) => {
write!(f, "ExactlyOneError[{:?}, {:?}, ...]", first, second)
write!(f, "ExactlyOneError[First: {:?}, Second: {:?}, RemainingIter: {:?}]", first, second, self.inner)
},
Some(Either::Right(second)) => {
write!(f, "ExactlyOneError[{:?}, ...]", second)
write!(f, "ExactlyOneError[Second: {:?}, RemainingIter: {:?}]", second, self.inner)
}
None => {
write!(f, "ExactlyOneError[...]")
write!(f, "ExactlyOneError[RemainingIter: {:?}]", self.inner)
}
}
}
}

#[cfg(feature = "use_std")]
impl<I> Error for ExactlyOneError<I> where I: Iterator, I::Item: Debug, {}
impl<I> Error for ExactlyOneError<I> where I: Iterator + Debug, I::Item: Debug, {}


0 comments on commit 8d73e8f

Please sign in to comment.