diff options
| author | bors <bors@rust-lang.org> | 2021-08-29 17:46:29 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-08-29 17:46:29 +0000 |
| commit | ae0b03bc6b4e1544f43b9a8053bdb0f0ed4a19e1 (patch) | |
| tree | 42249083f8e03da1de24a7b775c1d2e6e182954d /compiler/rustc_expand/src | |
| parent | daa4dc997c777676b0f0e48d0311cc5e7bde5f87 (diff) | |
| parent | c565339c37def41500c6d3175c2db3be8c5c4f76 (diff) | |
| download | rust-ae0b03bc6b4e1544f43b9a8053bdb0f0ed4a19e1.tar.gz rust-ae0b03bc6b4e1544f43b9a8053bdb0f0ed4a19e1.zip | |
Auto merge of #88262 - klensy:pprust-cow, r=nagisa
Cow'ify some pprust methods Reduce number of potential needless de/allocations by using `Cow<'static, str>` instead of explicit `String` type.
Diffstat (limited to 'compiler/rustc_expand/src')
| -rw-r--r-- | compiler/rustc_expand/src/mbe/macro_rules.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_expand/src/mbe/macro_rules.rs b/compiler/rustc_expand/src/mbe/macro_rules.rs index e0c62388fe0..f8491654f39 100644 --- a/compiler/rustc_expand/src/mbe/macro_rules.rs +++ b/compiler/rustc_expand/src/mbe/macro_rules.rs @@ -1221,7 +1221,7 @@ fn is_in_follow(tok: &mbe::TokenTree, kind: NonterminalKind) -> IsInFollow { fn quoted_tt_to_string(tt: &mbe::TokenTree) -> String { match *tt { - mbe::TokenTree::Token(ref token) => pprust::token_to_string(&token), + mbe::TokenTree::Token(ref token) => pprust::token_to_string(&token).into(), mbe::TokenTree::MetaVar(_, name) => format!("${}", name), mbe::TokenTree::MetaVarDecl(_, name, Some(kind)) => format!("${}:{}", name, kind), mbe::TokenTree::MetaVarDecl(_, name, None) => format!("${}:", name), |
