Remove duplication in name/trimmed_anem docs

Reference `DefId` in `CrateDef` docs to avoid duplicating long
description of `trimmed_name`
This commit is contained in:
NotLebedev 2025-03-02 13:02:20 +03:00
parent 141d2f3f02
commit a3378f5938
No known key found for this signature in database
GPG key ID: 4AC94C2E52F6E5F4

View file

@ -40,20 +40,15 @@ pub trait CrateDef {
fn def_id(&self) -> DefId;
/// Return the fully qualified name of the current definition.
///
/// See [`DefId::name`] for more details
fn name(&self) -> Symbol {
self.def_id().name()
}
/// Return a trimmed name of this definition.
///
/// This can be used to print more user friendly diagnostic messages.
///
/// If a symbol name can only be imported from one place for a type, and as
/// long as it was not glob-imported anywhere in the current crate, we trim its
/// path and print only the name.
///
/// For example, this function may shorten `std::vec::Vec` to just `Vec`,
/// as long as there is no other `Vec` importable anywhere.
/// See [`DefId::trimmed_name`] for more details
fn trimmed_name(&self) -> Symbol {
self.def_id().trimmed_name()
}