diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-08-01 16:49:34 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-01 16:49:34 +0200 |
| commit | 4606830f83ea8db9bc8f7861e8884c90b806beac (patch) | |
| tree | c65d01fc66f915131e40eb8e66e782c16bf1c5c4 | |
| parent | e6bb00fff51185f3d417b73bf32541b62e7c54db (diff) | |
| parent | 92b31ccb73223da007e427823b192dab0a86b91b (diff) | |
| download | rust-4606830f83ea8db9bc8f7861e8884c90b806beac.tar.gz rust-4606830f83ea8db9bc8f7861e8884c90b806beac.zip | |
Rollup merge of #100012 - TaKO8Ki:avoid-ty-to-string-conversions, r=fee1-dead
Avoid `Ty` to `String` conversions follow-up to #98668
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs index 7e8872d9018..e6907637c57 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs @@ -223,8 +223,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { if let Some(def) = aty.ty_adt_def() { // We also want to be able to select the slice's type's original // signature with no type arguments resolved - let type_string = self.tcx.type_of(def.did()).to_string(); - flags.push((sym::_Self, Some(format!("[{type_string}]")))); + flags.push((sym::_Self, Some(format!("[{}]", self.tcx.type_of(def.did()))))); } if aty.is_integral() { flags.push((sym::_Self, Some("[{integral}]".to_string()))); @@ -242,10 +241,10 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { if let Some(def) = aty.ty_adt_def() { // We also want to be able to select the array's type's original // signature with no type arguments resolved - let type_string = self.tcx.type_of(def.did()).to_string(); - flags.push((sym::_Self, Some(format!("[{type_string}; _]")))); + let def_ty = self.tcx.type_of(def.did()); + flags.push((sym::_Self, Some(format!("[{def_ty}; _]")))); if let Some(n) = len { - flags.push((sym::_Self, Some(format!("[{type_string}; {n}]")))); + flags.push((sym::_Self, Some(format!("[{def_ty}; {n}]")))); } } if aty.is_integral() { |
