We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents c1a19b8 + 0d1ab4e commit 69f4126Copy full SHA for 69f4126
src/libsyntax_ext/deriving/mod.rs
@@ -154,11 +154,13 @@ pub fn expand_derive(cx: &mut ExtCtxt,
154
});
155
if new_attributes.len() > 0 {
156
item = item.map(|mut i| {
157
- let list = cx.meta_list(mitem.span,
158
- intern_and_get_ident("derive"),
159
- traits);
160
i.attrs.extend(new_attributes);
161
- i.attrs.push(cx.attribute(mitem.span, list));
+ if traits.len() > 0 {
+ let list = cx.meta_list(mitem.span,
+ intern_and_get_ident("derive"),
+ traits);
162
+ i.attrs.push(cx.attribute(mitem.span, list));
163
+ }
164
i
165
166
return vec![Annotatable::Item(item)]
0 commit comments