No cloning

This commit is contained in:
topecongiro 2017-09-06 19:24:14 +09:00
parent 0d748cf4c8
commit 4bd0373757

View File

@ -300,7 +300,8 @@ pub fn visit_item(&mut self, item: &ast::Item) {
// complex in the module case. It is complex because the module could be
// in a separate file and there might be attributes in both files, but
// the AST lumps them all together.
let mut attrs = item.attrs.clone();
let filterd_attrs;
let mut attrs = &item.attrs;
match item.node {
ast::ItemKind::Mod(ref m) => {
let outer_file = self.codemap.lookup_char_pos(item.span.lo()).file;
@ -318,7 +319,7 @@ pub fn visit_item(&mut self, item: &ast::Item) {
} else {
// Module is not inline and should not be skipped. We want
// to process only the attributes in the current file.
let filterd_attrs = item.attrs
filterd_attrs = item.attrs
.iter()
.filter_map(|a| {
let attr_file = self.codemap.lookup_char_pos(a.span.lo()).file;
@ -332,7 +333,7 @@ pub fn visit_item(&mut self, item: &ast::Item) {
// Assert because if we should skip it should be caught by
// the above case.
assert!(!self.visit_attrs(&filterd_attrs, ast::AttrStyle::Outer));
attrs = filterd_attrs;
attrs = &filterd_attrs;
}
}
_ => if self.visit_attrs(&item.attrs, ast::AttrStyle::Outer) {