about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJubilee <46493976+workingjubilee@users.noreply.github.com>2023-12-15 14:08:17 -0800
committerGitHub <noreply@github.com>2023-12-15 14:08:17 -0800
commit3d94fc9dfe24a065c323b1c7a3bdd1c2fdc9cf11 (patch)
tree2543cb2d88bdce5a93c718341d10e51fc6614067
parent5e85fece3ae55dc2eb7e6871bffbdf4db3c7b999 (diff)
parent8142e8555a1ed10dad997a2c2b71e9ad73ea1bde (diff)
downloadrust-3d94fc9dfe24a065c323b1c7a3bdd1c2fdc9cf11.tar.gz
rust-3d94fc9dfe24a065c323b1c7a3bdd1c2fdc9cf11.zip
Rollup merge of #118981 - krtab:onelessalloc, r=compiler-errors
Remove an unneeded allocation

This removes an unneeded allocation in `<&[hir::GenericParam<'_>] as NextTypeParamName>::next_type_param_name`
-rw-r--r--compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
index c3f97e34e39..a1b896d2251 100644
--- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
+++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
@@ -4665,7 +4665,7 @@ pub trait NextTypeParamName {
 impl NextTypeParamName for &[hir::GenericParam<'_>] {
     fn next_type_param_name(&self, name: Option<&str>) -> String {
         // This is the list of possible parameter names that we might suggest.
-        let name = name.and_then(|n| n.chars().next()).map(|c| c.to_string().to_uppercase());
+        let name = name.and_then(|n| n.chars().next()).map(|c| c.to_uppercase().to_string());
         let name = name.as_deref();
         let possible_names = [name.unwrap_or("T"), "T", "U", "V", "X", "Y", "Z", "A", "B", "C"];
         let used_names = self