internal: Replace Display impl for Name

This commit is contained in:
Lukas Wirth 2023-05-24 18:04:29 +02:00
parent 2f840c2236
commit c7ef6c25b7
108 changed files with 1045 additions and 656 deletions

View file

@ -4,7 +4,7 @@
use std::collections::hash_map::Entry;
use base_db::CrateId;
use hir_expand::{attrs::AttrId, name::Name, AstId, MacroCallId};
use hir_expand::{attrs::AttrId, db::ExpandDatabase, name::Name, AstId, MacroCallId};
use itertools::Itertools;
use once_cell::sync::Lazy;
use profile::Count;
@ -358,12 +358,16 @@ impl ItemScope {
}
}
pub(crate) fn dump(&self, buf: &mut String) {
pub(crate) fn dump(&self, db: &dyn ExpandDatabase, buf: &mut String) {
let mut entries: Vec<_> = self.resolutions().collect();
entries.sort_by_key(|(name, _)| name.clone());
for (name, def) in entries {
format_to!(buf, "{}:", name.map_or("_".to_string(), |name| name.to_string()));
format_to!(
buf,
"{}:",
name.map_or("_".to_string(), |name| name.display(db).to_string())
);
if def.types.is_some() {
buf.push_str(" t");