Skip to content

Commit d7cbdb5

Browse files
authored
Merge pull request #242 from rust-num/feat/do-not-duplicate-enum-definition
Fix code duplication error (Overriding a CI failure due to `num-macros`.)
2 parents 8489f0c + 20243f5 commit d7cbdb5

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

derive/src/lib.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@ pub fn from_primitive(input: TokenStream) -> TokenStream {
3030

3131
let variants = match ast.body {
3232
Enum(ref variants) => variants,
33-
_ => {
34-
panic!("`FromPrimitive` can be applied only to the enums, {} is not an enum",
35-
name)
36-
}
33+
_ => panic!("`FromPrimitive` can be applied only to the enums, {} is not an enum", name)
3734
};
3835

3936
let mut idx = 0;
@@ -56,8 +53,6 @@ pub fn from_primitive(input: TokenStream) -> TokenStream {
5653
.collect();
5754

5855
let res = quote! {
59-
#ast
60-
6156
impl ::num::traits::FromPrimitive for #name {
6257
fn from_i64(n: i64) -> Option<Self> {
6358
Self::from_u64(n as u64)

0 commit comments

Comments
 (0)