aboutsummaryrefslogtreecommitdiff
path: root/macros/src/factory
diff options
context:
space:
mode:
Diffstat (limited to 'macros/src/factory')
-rw-r--r--macros/src/factory/declare_default_args.rs23
-rw-r--r--macros/src/factory/macro_args.rs8
-rw-r--r--macros/src/factory/type_alias.rs8
3 files changed, 13 insertions, 26 deletions
diff --git a/macros/src/factory/declare_default_args.rs b/macros/src/factory/declare_default_args.rs
index f93d29d..9930f4f 100644
--- a/macros/src/factory/declare_default_args.rs
+++ b/macros/src/factory/declare_default_args.rs
@@ -57,8 +57,6 @@ impl Parse for DeclareDefaultFactoryMacroArgs
#[cfg(test)]
mod tests
{
- use std::error::Error;
-
use proc_macro2::Span;
use quote::{format_ident, quote};
use syn::token::Dyn;
@@ -80,13 +78,14 @@ mod tests
use crate::macro_flag::MacroFlagValue;
#[test]
- fn can_parse_with_interface_only() -> Result<(), Box<dyn Error>>
+ fn can_parse_with_interface_only()
{
let input_args = quote! {
dyn IFoo
};
- let dec_def_fac_args = parse2::<DeclareDefaultFactoryMacroArgs>(input_args)?;
+ let dec_def_fac_args =
+ parse2::<DeclareDefaultFactoryMacroArgs>(input_args).unwrap();
assert_eq!(
dec_def_fac_args.interface,
@@ -108,18 +107,17 @@ mod tests
);
assert!(dec_def_fac_args.flags.is_empty());
-
- Ok(())
}
#[test]
- fn can_parse_with_interface_and_single_flag() -> Result<(), Box<dyn Error>>
+ fn can_parse_with_interface_and_single_flag()
{
let input_args = quote! {
dyn IBar, threadsafe = true
};
- let dec_def_fac_args = parse2::<DeclareDefaultFactoryMacroArgs>(input_args)?;
+ let dec_def_fac_args =
+ parse2::<DeclareDefaultFactoryMacroArgs>(input_args).unwrap();
assert_eq!(
dec_def_fac_args.interface,
@@ -150,18 +148,17 @@ mod tests
)))
}])
);
-
- Ok(())
}
#[test]
- fn can_parse_with_interface_and_multiple_flags() -> Result<(), Box<dyn Error>>
+ fn can_parse_with_interface_and_multiple_flags()
{
let input_args = quote! {
dyn IBar, threadsafe = true, async = false
};
- let dec_def_fac_args = parse2::<DeclareDefaultFactoryMacroArgs>(input_args)?;
+ let dec_def_fac_args =
+ parse2::<DeclareDefaultFactoryMacroArgs>(input_args).unwrap();
assert_eq!(
dec_def_fac_args.interface,
@@ -201,8 +198,6 @@ mod tests
}
])
);
-
- Ok(())
}
#[test]
diff --git a/macros/src/factory/macro_args.rs b/macros/src/factory/macro_args.rs
index 76b29a2..676b412 100644
--- a/macros/src/factory/macro_args.rs
+++ b/macros/src/factory/macro_args.rs
@@ -46,8 +46,6 @@ impl Parse for FactoryMacroArgs
#[cfg(test)]
mod tests
{
- use std::error::Error;
-
use proc_macro2::Span;
use quote::{format_ident, quote};
use syn::{parse2, Lit, LitBool};
@@ -56,13 +54,13 @@ mod tests
use crate::macro_flag::MacroFlagValue;
#[test]
- fn can_parse_with_single_flag() -> Result<(), Box<dyn Error>>
+ fn can_parse_with_single_flag()
{
let input_args = quote! {
threadsafe = true
};
- let factory_macro_args = parse2::<FactoryMacroArgs>(input_args)?;
+ let factory_macro_args = parse2::<FactoryMacroArgs>(input_args).unwrap();
assert_eq!(
factory_macro_args.flags,
@@ -74,8 +72,6 @@ mod tests
)))
}])
);
-
- Ok(())
}
#[test]
diff --git a/macros/src/factory/type_alias.rs b/macros/src/factory/type_alias.rs
index fafcd54..cfa254f 100644
--- a/macros/src/factory/type_alias.rs
+++ b/macros/src/factory/type_alias.rs
@@ -31,8 +31,6 @@ impl Parse for FactoryTypeAlias
#[cfg(test)]
mod tests
{
- use std::error::Error;
-
use quote::{format_ident, quote};
use syn::punctuated::Punctuated;
use syn::token::And;
@@ -42,13 +40,13 @@ mod tests
use crate::test_utils;
#[test]
- fn can_parse() -> Result<(), Box<dyn Error>>
+ fn can_parse()
{
let input_args = quote! {
type FooFactory = dyn Fn(String, &u32) -> Foo;
};
- let factory_type_alias = parse2::<FactoryTypeAlias>(input_args)?;
+ let factory_type_alias = parse2::<FactoryTypeAlias>(input_args).unwrap();
assert_eq!(
factory_type_alias.factory_interface.inputs,
@@ -66,7 +64,5 @@ mod tests
})
])
);
-
- Ok(())
}
}