We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8489f0c commit 20243f5Copy full SHA for 20243f5
derive/src/lib.rs
@@ -30,10 +30,7 @@ pub fn from_primitive(input: TokenStream) -> TokenStream {
30
31
let variants = match ast.body {
32
Enum(ref variants) => variants,
33
- _ => {
34
- panic!("`FromPrimitive` can be applied only to the enums, {} is not an enum",
35
- name)
36
- }
+ _ => panic!("`FromPrimitive` can be applied only to the enums, {} is not an enum", name)
37
};
38
39
let mut idx = 0;
@@ -56,8 +53,6 @@ pub fn from_primitive(input: TokenStream) -> TokenStream {
56
53
.collect();
57
54
58
55
let res = quote! {
59
- #ast
60
-
61
impl ::num::traits::FromPrimitive for #name {
62
fn from_i64(n: i64) -> Option<Self> {
63
Self::from_u64(n as u64)
0 commit comments