From c565339c37def41500c6d3175c2db3be8c5c4f76 Mon Sep 17 00:00:00 2001 From: klensy Date: Sun, 22 Aug 2021 19:55:45 +0300 Subject: Convert some functions to return Cow<'static,str> instead of String to reduce potential reallocations --- compiler/rustc_parse/src/parser/expr.rs | 2 +- compiler/rustc_parse/src/parser/mod.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'compiler/rustc_parse/src') 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(); -- cgit 1.4.1-3-g733a5