Closed
Description
pub trait ItemDecorator {
fn expand(&self, ecx: &mut ExtCtxt, sp: Span, meta_item: &MetaItem, item: &Item, push: &mut FnMut(P<Item>));
}
is deprecated in favor of
pub trait MultiItemDecorator {
fn expand(&self, ecx: &mut ExtCtxt, sp: Span, meta_item: &MetaItem, item: Annotatable, push: &mut FnMut(Annotatable));
}
The new version takes the thing being decorated by-move, and this is achieved by a clone. The clone is totally unnecessary; a decorator doesn't modify the original item and should be fine with a simple reference to it.
This probably causes a lot of unnecessary clones since MultiDecorators are used everywhere in the form of #[derive]
.
Should we make this &Annotatable
and remove the clone?