1
Fork 0

Avoid cloning the contents of a TokenStream in a few places

This commit is contained in:
Aaron Hill 2020-09-14 01:45:10 -04:00
parent cb2462c53f
commit f6aec82d4d
No known key found for this signature in database
GPG key ID: B4087E510E98B164
3 changed files with 12 additions and 11 deletions

View file

@ -288,7 +288,8 @@ fn generic_extension<'cx>(
// Replace all the tokens for the corresponding positions in the macro, to maintain
// proper positions in error reporting, while maintaining the macro_backtrace.
if rhs_spans.len() == tts.len() {
tts = tts.map_enumerated(|i, mut tt| {
tts = tts.map_enumerated(|i, tt| {
let mut tt = tt.clone();
let mut sp = rhs_spans[i];
sp = sp.with_ctxt(tt.span().ctxt());
tt.set_span(sp);