mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-15 20:45:45 +03:00
Replace usages of Context.def_name
Use `DefId.name` and `DefId.trimmed_name` instead
This commit is contained in:
@@ -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 @@ fn name(&self) -> Symbol {
|
||||
/// 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 @@
|
||||
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user