Skip to content

Commit

Permalink
Rollup merge of rust-lang#135199 - joshtriplett:unnecessary-to-string…
Browse files Browse the repository at this point in the history
…, r=lqd

Eliminate an unnecessary `Symbol::to_string`; use `as_str`
  • Loading branch information
GuillaumeGomez authored Jan 7, 2025
2 parents ec26620 + 7cc99a8 commit 225ffeb
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -448,18 +448,17 @@ pub(crate) fn encode_ty<'tcx>(
if let Some(cfi_encoding) = tcx.get_attr(def_id, sym::cfi_encoding) {
// Use user-defined CFI encoding for type
if let Some(value_str) = cfi_encoding.value_str() {
let value_str = value_str.to_string();
let str = value_str.trim();
if !str.is_empty() {
s.push_str(str);
let value_str = value_str.as_str().trim();
if !value_str.is_empty() {
s.push_str(value_str);
// Don't compress user-defined builtin types (see
// https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling-builtin and
// https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling-compression).
let builtin_types = [
"v", "w", "b", "c", "a", "h", "s", "t", "i", "j", "l", "m", "x", "y",
"n", "o", "f", "d", "e", "g", "z", "Dh",
];
if !builtin_types.contains(&str) {
if !builtin_types.contains(&value_str) {
compress(dict, DictKey::Ty(ty, TyQ::None), &mut s);
}
} else {
Expand Down

0 comments on commit 225ffeb

Please sign in to comment.