1
Fork 0

Simplify some match statements on `DefPathDataName'

This commit is contained in:
marmeladema 2020-09-01 13:11:28 +01:00
parent 75130b06bf
commit bb8e1764bb
3 changed files with 5 additions and 22 deletions

View file

@ -3,7 +3,6 @@
use rustc_data_structures::fx::FxHashSet;
use rustc_hir as hir;
use rustc_hir::def_id::DefId;
use rustc_hir::definitions::DefPathDataName;
use rustc_middle::ty::{self, subst::SubstsRef, Ty, TyCtxt};
use std::fmt::Write;
@ -231,13 +230,7 @@ pub fn push_debuginfo_type_name<'tcx>(
if qualified {
output.push_str(&tcx.crate_name(def_id.krate).as_str());
for path_element in tcx.def_path(def_id).data {
output.push_str("::");
match path_element.data.name() {
DefPathDataName::Named(name) => output.push_str(&name.as_str()),
DefPathDataName::Anon { namespace } => {
write!(output, "{{{{{}}}}}", namespace).unwrap()
}
}
write!(output, "::{}", path_element.data).unwrap();
}
} else {
output.push_str(&tcx.item_name(def_id).as_str());