diff options
author | Matthias Krüger <[email protected]> | 2021-03-17 00:56:31 +0000 |
---|---|---|
committer | Matthias Krüger <[email protected]> | 2021-03-17 00:56:31 +0000 |
commit | 048dad8c2e86006e53b3a134279729efb28b9e32 (patch) | |
tree | b9e584f4d1c276b60cb0bd7cee3a4ad158a0ac66 /crates/mbe/src | |
parent | c5d654d5132b702d028ed00b5ec5c654a0b4a2fa (diff) |
don't clone types that are copy (clippy::clone_on_copy)
Diffstat (limited to 'crates/mbe/src')
-rw-r--r-- | crates/mbe/src/benchmark.rs | 5 | ||||
-rw-r--r-- | crates/mbe/src/parser.rs | 2 |
2 files changed, 3 insertions, 4 deletions
diff --git a/crates/mbe/src/benchmark.rs b/crates/mbe/src/benchmark.rs index bd8ea6452..ba814a2e1 100644 --- a/crates/mbe/src/benchmark.rs +++ b/crates/mbe/src/benchmark.rs | |||
@@ -165,7 +165,7 @@ fn invocation_fixtures(rules: &FxHashMap<String, MacroRules>) -> Vec<(String, tt | |||
165 | } | 165 | } |
166 | Separator::Puncts(puncts) => { | 166 | Separator::Puncts(puncts) => { |
167 | for it in puncts { | 167 | for it in puncts { |
168 | parent.token_trees.push(tt::Leaf::Punct(it.clone()).into()) | 168 | parent.token_trees.push(tt::Leaf::Punct(*it).into()) |
169 | } | 169 | } |
170 | } | 170 | } |
171 | }; | 171 | }; |
@@ -174,8 +174,7 @@ fn invocation_fixtures(rules: &FxHashMap<String, MacroRules>) -> Vec<(String, tt | |||
174 | } | 174 | } |
175 | } | 175 | } |
176 | Op::Subtree { tokens, delimiter } => { | 176 | Op::Subtree { tokens, delimiter } => { |
177 | let mut subtree = | 177 | let mut subtree = tt::Subtree { delimiter: *delimiter, token_trees: Vec::new() }; |
178 | tt::Subtree { delimiter: delimiter.clone(), token_trees: Vec::new() }; | ||
179 | tokens.iter().for_each(|it| { | 178 | tokens.iter().for_each(|it| { |
180 | collect_from_op(it, &mut subtree, seed); | 179 | collect_from_op(it, &mut subtree, seed); |
181 | }); | 180 | }); |
diff --git a/crates/mbe/src/parser.rs b/crates/mbe/src/parser.rs index 8671322e1..7b5b8ec16 100644 --- a/crates/mbe/src/parser.rs +++ b/crates/mbe/src/parser.rs | |||
@@ -262,7 +262,7 @@ fn parse_repeat(src: &mut TtIter) -> Result<(Option<Separator>, RepeatKind), Par | |||
262 | if puncts.len() == 3 { | 262 | if puncts.len() == 3 { |
263 | return Err(ParseError::InvalidRepeat); | 263 | return Err(ParseError::InvalidRepeat); |
264 | } | 264 | } |
265 | puncts.push(punct.clone()) | 265 | puncts.push(*punct) |
266 | } | 266 | } |
267 | _ => return Err(ParseError::InvalidRepeat), | 267 | _ => return Err(ParseError::InvalidRepeat), |
268 | } | 268 | } |