summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <ecoal95@gmail.com>2016-04-02 03:33:52 +0200
committerEmilio Cobos Álvarez <ecoal95@gmail.com>2016-04-02 03:33:52 +0200
commit0aa7464ff605c6b2b6caed780d3bf76e1167aa78 (patch)
tree0f2b73f5990c21a3e1bac9f731f5d5d57e505276
parentebc6381b6028a5e078aef0a7a1240be0737441e6 (diff)
gen: Derive clone instead of implementing it for enums
Actually they have no risk of not being clone-able, and the output is just nicer.
-rw-r--r--src/gen.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/gen.rs b/src/gen.rs
index 48bddce5..3b85cadb 100644
--- a/src/gen.rs
+++ b/src/gen.rs
@@ -1493,7 +1493,11 @@ fn cenum_to_rs(ctx: &mut GenCtx,
is_sugared_doc: false,
}));
- attrs.push(mk_deriving_copy_and_maybe_debug_attr(ctx));
+ attrs.push(if ctx.options.derive_debug {
+ mk_deriving_attr(ctx, &["Debug", "Copy", "Clone"])
+ } else {
+ mk_deriving_attr(ctx, &["Copy", "Clone"])
+ });
items.push(P(ast::Item {
ident: enum_name,
@@ -1504,8 +1508,6 @@ fn cenum_to_rs(ctx: &mut GenCtx,
span: ctx.span,
}));
- items.push(mk_clone_impl(ctx, &name));
-
items
}