File tree Expand file tree Collapse file tree 2 files changed +3
-8
lines changed Expand file tree Collapse file tree 2 files changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -41,8 +41,7 @@ pub trait CrateDef {
41
41
42
42
/// Return the fully qualified name of the current definition.
43
43
fn name(&self) -> Symbol {
44
- let def_id = self.def_id();
45
- with(|cx| cx.def_name(def_id, false))
44
+ self.def_id().name()
46
45
}
47
46
48
47
/// Return a trimmed name of this definition.
@@ -56,8 +55,7 @@ pub trait CrateDef {
56
55
/// For example, this function may shorten `std::vec::Vec` to just `Vec`,
57
56
/// as long as there is no other `Vec` importable anywhere.
58
57
fn trimmed_name(&self) -> Symbol {
59
- let def_id = self.def_id();
60
- with(|cx| cx.def_name(def_id, true))
58
+ self.def_id().trimmed_name()
61
59
}
62
60
63
61
/// Return information about the crate where this definition is declared.
Original file line number Diff line number Diff line change @@ -48,10 +48,7 @@ pub type CrateNum = usize;
48
48
49
49
impl Debug for DefId {
50
50
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
51
- f.debug_struct("DefId")
52
- .field("id", &self.0)
53
- .field("name", &with(|cx| cx.def_name(*self, false)))
54
- .finish()
51
+ f.debug_struct("DefId").field("id", &self.0).field("name", &self.name()).finish()
55
52
}
56
53
}
57
54
You can’t perform that action at this time.
0 commit comments