about summary refs log tree commit diff
diff options
context:
space:
mode:
authorklensy <klensy@users.noreply.github.com>2021-05-30 22:44:40 +0300
committerklensy <klensy@users.noreply.github.com>2021-05-30 22:44:40 +0300
commit56a2a2ae1f1a4174d8159cc7b6adfc26d19e11c9 (patch)
tree9dc7abcbbcc7b961479c3953eb0e04eda7f7d242
parent2023cc3aa1ea98530f3124ed07713e6f95fd26ab (diff)
downloadrust-56a2a2ae1f1a4174d8159cc7b6adfc26d19e11c9.tar.gz
rust-56a2a2ae1f1a4174d8159cc7b6adfc26d19e11c9.zip
don't clone attrs
-rw-r--r--compiler/rustc_ast/src/tokenstream.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/compiler/rustc_ast/src/tokenstream.rs b/compiler/rustc_ast/src/tokenstream.rs
index 2d463a4588c..5d994dbad4d 100644
--- a/compiler/rustc_ast/src/tokenstream.rs
+++ b/compiler/rustc_ast/src/tokenstream.rs
@@ -218,8 +218,7 @@ impl AttrAnnotatedTokenStream {
                 AttrAnnotatedTokenTree::Attributes(data) => {
                     let mut outer_attrs = Vec::new();
                     let mut inner_attrs = Vec::new();
-                    let attrs: Vec<_> = data.attrs.clone().into();
-                    for attr in attrs {
+                    for attr in &data.attrs {
                         match attr.style {
                             crate::AttrStyle::Outer => {
                                 assert!(
@@ -264,7 +263,7 @@ impl AttrAnnotatedTokenStream {
                                 // so we never reach this code.
 
                                 let mut builder = TokenStreamBuilder::new();
-                                for inner_attr in &inner_attrs {
+                                for inner_attr in inner_attrs {
                                     builder.push(inner_attr.tokens().to_tokenstream());
                                 }
                                 builder.push(delim_tokens.clone());