about summary refs log tree commit diff
path: root/compiler/rustc_parse/src
diff options
context:
space:
mode:
authorklensy <klensy@users.noreply.github.com>2021-08-22 19:55:45 +0300
committerklensy <klensy@users.noreply.github.com>2021-08-25 00:24:44 +0300
commitc565339c37def41500c6d3175c2db3be8c5c4f76 (patch)
tree84c10d644be15d113f565b4061cfcfd34f4f0912 /compiler/rustc_parse/src
parent2ad56d5c9031636c1509f4417e88099a49405b4e (diff)
downloadrust-c565339c37def41500c6d3175c2db3be8c5c4f76.tar.gz
rust-c565339c37def41500c6d3175c2db3be8c5c4f76.zip
Convert some functions to return Cow<'static,str> instead of String to reduce potential reallocations
Diffstat (limited to 'compiler/rustc_parse/src')
-rw-r--r--compiler/rustc_parse/src/parser/expr.rs2
-rw-r--r--compiler/rustc_parse/src/parser/mod.rs2
2 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs
index 6259eff5a1a..7952b475dc2 100644
--- a/compiler/rustc_parse/src/parser/expr.rs
+++ b/compiler/rustc_parse/src/parser/expr.rs
@@ -1528,7 +1528,7 @@ impl<'a> Parser<'a> {
             .span_suggestion(
                 token.span,
                 "must have an integer part",
-                pprust::token_to_string(token),
+                pprust::token_to_string(token).into(),
                 Applicability::MachineApplicable,
             )
             .emit();
diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs
index 51d4e007b59..04ad323e51a 100644
--- a/compiler/rustc_parse/src/parser/mod.rs
+++ b/compiler/rustc_parse/src/parser/mod.rs
@@ -806,7 +806,7 @@ impl<'a> Parser<'a> {
                                         .span_suggestion_short(
                                             sp,
                                             &format!("missing `{}`", token_str),
-                                            token_str,
+                                            token_str.into(),
                                             Applicability::MaybeIncorrect,
                                         )
                                         .emit();