Replace usages of Context.def_name
Use `DefId.name` and `DefId.trimmed_name` instead
This commit is contained in:
parent
298fb8af65
commit
141d2f3f02
2 changed files with 3 additions and 8 deletions
|
|
@ -41,8 +41,7 @@ pub trait CrateDef {
|
|||
|
||||
/// Return the fully qualified name of the current definition.
|
||||
fn name(&self) -> Symbol {
|
||||
let def_id = self.def_id();
|
||||
with(|cx| cx.def_name(def_id, false))
|
||||
self.def_id().name()
|
||||
}
|
||||
|
||||
/// Return a trimmed name of this definition.
|
||||
|
|
@ -56,8 +55,7 @@ pub trait CrateDef {
|
|||
/// For example, this function may shorten `std::vec::Vec` to just `Vec`,
|
||||
/// as long as there is no other `Vec` importable anywhere.
|
||||
fn trimmed_name(&self) -> Symbol {
|
||||
let def_id = self.def_id();
|
||||
with(|cx| cx.def_name(def_id, true))
|
||||
self.def_id().trimmed_name()
|
||||
}
|
||||
|
||||
/// Return information about the crate where this definition is declared.
|
||||
|
|
|
|||
|
|
@ -48,10 +48,7 @@ pub type CrateNum = usize;
|
|||
|
||||
impl Debug for DefId {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("DefId")
|
||||
.field("id", &self.0)
|
||||
.field("name", &with(|cx| cx.def_name(*self, false)))
|
||||
.finish()
|
||||
f.debug_struct("DefId").field("id", &self.0).field("name", &self.name()).finish()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue