Skip to content

Commit 252969f

Browse files
committed
Make availability of Error impl conditional
1 parent d2c8109 commit 252969f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/exactly_one_err.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
#[cfg(feature = "use_std")]
12
use std::error::Error;
3+
#[cfg(feature = "use_std")]
24
use std::fmt::{Debug, Display, Formatter, Result as FmtResult};
5+
36
use std::iter::ExactSizeIterator;
47

58
use either::Either;
@@ -70,6 +73,7 @@ where
7073

7174
impl<I> ExactSizeIterator for ExactlyOneError<I> where I: ExactSizeIterator {}
7275

76+
#[cfg(feature = "use_std")]
7377
impl<I> Display for ExactlyOneError<I>
7478
where I: Iterator
7579
{
@@ -83,6 +87,7 @@ impl<I> Display for ExactlyOneError<I>
8387
}
8488
}
8589

90+
#[cfg(feature = "use_std")]
8691
impl<I> Debug for ExactlyOneError<I>
8792
where I: Iterator,
8893
I::Item: Debug,
@@ -102,9 +107,10 @@ impl<I> Debug for ExactlyOneError<I>
102107
}
103108
}
104109

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

107-
#[cfg(test)]
113+
#[cfg(all(test, feature = "use_std"))]
108114
mod tests {
109115
use super::*;
110116

0 commit comments

Comments
 (0)