diff --git a/tests/test_from.rs b/tests/test_from.rs index b6a3c0c..957d6cf 100644 --- a/tests/test_from.rs +++ b/tests/test_from.rs @@ -14,10 +14,21 @@ pub struct ErrorStruct { source: io::Error, } +#[derive(Error, Debug)] +#[error("...")] +pub struct ErrorStructOptional { + #[from] + source: Option, +} + #[derive(Error, Debug)] #[error("...")] pub struct ErrorTuple(#[from] io::Error); +#[derive(Error, Debug)] +#[error("...")] +pub struct ErrorTupleOptional(#[from] Option); + #[derive(Error, Debug)] #[error("...")] pub enum ErrorEnum { @@ -27,6 +38,15 @@ pub enum ErrorEnum { }, } +#[derive(Error, Debug)] +#[error("...")] +pub enum ErrorEnumOptional { + Test { + #[from] + source: Option, + }, +} + #[derive(Error, Debug)] #[error("...")] pub enum Many { @@ -39,7 +59,10 @@ fn assert_impl>() {} #[test] fn test_from() { assert_impl::(); + assert_impl::(); assert_impl::(); + assert_impl::(); assert_impl::(); + assert_impl::(); assert_impl::(); }