1
Fork 0

avoid some Symbol to String conversions

This commit is contained in:
Takayuki Maeda 2022-07-17 04:09:20 +09:00
parent 95e77648e4
commit c54d4ada26
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!(