From 20243f5baa615b92e208cc071218bc78d46a99b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Jan=20Niemier?= Date: Sun, 27 Nov 2016 19:31:33 +0100 Subject: [PATCH] fix(num_derive): code duplication error Fixes #240 --- derive/src/lib.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/derive/src/lib.rs b/derive/src/lib.rs index 49854b5..9e1804d 100644 --- a/derive/src/lib.rs +++ b/derive/src/lib.rs @@ -30,10 +30,7 @@ pub fn from_primitive(input: TokenStream) -> TokenStream { let variants = match ast.body { Enum(ref variants) => variants, - _ => { - panic!("`FromPrimitive` can be applied only to the enums, {} is not an enum", - name) - } + _ => panic!("`FromPrimitive` can be applied only to the enums, {} is not an enum", name) }; let mut idx = 0; @@ -56,8 +53,6 @@ pub fn from_primitive(input: TokenStream) -> TokenStream { .collect(); let res = quote! { - #ast - impl ::num::traits::FromPrimitive for #name { fn from_i64(n: i64) -> Option { Self::from_u64(n as u64)