Skip to content

Commit 225ffeb

Browse files
Rollup merge of #135199 - joshtriplett:unnecessary-to-string, r=lqd
Eliminate an unnecessary `Symbol::to_string`; use `as_str`
2 parents ec26620 + 7cc99a8 commit 225ffeb

File tree

1 file changed

+4
-5
lines changed
  • compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi

1 file changed

+4
-5
lines changed

Diff for: compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/encode.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -448,18 +448,17 @@ pub(crate) fn encode_ty<'tcx>(
448448
if let Some(cfi_encoding) = tcx.get_attr(def_id, sym::cfi_encoding) {
449449
// Use user-defined CFI encoding for type
450450
if let Some(value_str) = cfi_encoding.value_str() {
451-
let value_str = value_str.to_string();
452-
let str = value_str.trim();
453-
if !str.is_empty() {
454-
s.push_str(str);
451+
let value_str = value_str.as_str().trim();
452+
if !value_str.is_empty() {
453+
s.push_str(value_str);
455454
// Don't compress user-defined builtin types (see
456455
// https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling-builtin and
457456
// https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling-compression).
458457
let builtin_types = [
459458
"v", "w", "b", "c", "a", "h", "s", "t", "i", "j", "l", "m", "x", "y",
460459
"n", "o", "f", "d", "e", "g", "z", "Dh",
461460
];
462-
if !builtin_types.contains(&str) {
461+
if !builtin_types.contains(&value_str) {
463462
compress(dict, DictKey::Ty(ty, TyQ::None), &mut s);
464463
}
465464
} else {

0 commit comments

Comments
 (0)