1
Fork 0

Rollup merge of #99342 - TaKO8Ki:avoid-symbol-to-string-conversions, r=compiler-errors

Avoid some `Symbol` to `String` conversions

This patch removes some Symbol to String conversions.
This commit is contained in:
Matthias Krüger 2022-07-16 22:30:56 +02:00 committed by GitHub
commit 6277ac2fb8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 50 additions and 59 deletions

View file

@ -1,11 +1,12 @@
use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::sync::Lock;
use rustc_span::Symbol;
use rustc_target::abi::{Align, Size};
use std::cmp::{self, Ordering};
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
pub struct VariantInfo {
pub name: Option<String>,
pub name: Option<Symbol>,
pub kind: SizeKind,
pub size: u64,
pub align: u64,
@ -20,7 +21,7 @@ pub enum SizeKind {
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
pub struct FieldInfo {
pub name: String,
pub name: Symbol,
pub offset: u64,
pub size: u64,
pub align: u64,
@ -119,7 +120,7 @@ impl CodeStats {
let VariantInfo { ref name, kind: _, align: _, size, ref fields } = *variant_info;
let indent = if !struct_like {
let name = match name.as_ref() {
Some(name) => name.to_owned(),
Some(name) => name.to_string(),
None => i.to_string(),
};
println!(