mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
Don't unnecessarily clone the input tt for decl macros
This commit is contained in:
parent
d5f64f875a
commit
f6c09099da
3 changed files with 23 additions and 12 deletions
|
@ -311,9 +311,7 @@ impl DeclarativeMacro {
|
|||
DeclarativeMacro { rules: rules.into_boxed_slice(), shift: Shift::new(tt), is_2021, err }
|
||||
}
|
||||
|
||||
pub fn expand(&self, tt: &tt::Subtree) -> ExpandResult<tt::Subtree> {
|
||||
// apply shift
|
||||
let mut tt = tt.clone();
|
||||
pub fn expand(&self, mut tt: tt::Subtree) -> ExpandResult<tt::Subtree> {
|
||||
self.shift.shift_all(&mut tt);
|
||||
expander::expand_rules(&self.rules, &tt, self.is_2021)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue