Fix the problem described in #80

This commit is contained in:
sunli 2020-05-13 11:37:07 +08:00
parent 352f9e44af
commit a4a92dcb8c

View File

@ -10,10 +10,10 @@ pub enum OutputType<'a> {
impl<'a> OutputType<'a> {
pub fn parse(input: &'a Type) -> Result<Self> {
let ty = if let Type::Path(p) = input {
if p.path.segments.last().unwrap().ident == "Result"
|| p.path.segments.last().unwrap().ident == "FieldResult"
{
if let PathArguments::AngleBracketed(args) = &p.path.segments[0].arguments {
if p.path.segments.last().unwrap().ident == "FieldResult" {
if let PathArguments::AngleBracketed(args) =
&p.path.segments.last().unwrap().arguments
{
if args.args.is_empty() {
return Err(Error::new_spanned(input, "Invalid type"));
}