internal: fix panic in view_crate_graph

This commit is contained in:
David Barsky 2025-04-01 12:47:11 -04:00
parent 6ca780700d
commit 069de21793

View File

@ -1,4 +1,5 @@
use dot::{Id, LabelText}; use dot::{Id, LabelText};
use ide_db::base_db::salsa::plumbing::AsId;
use ide_db::{ use ide_db::{
FxHashMap, RootDatabase, FxHashMap, RootDatabase,
base_db::{ base_db::{
@ -78,7 +79,8 @@ impl<'a> dot::Labeller<'a, Crate, Edge<'a>> for DotCrateGraph<'_> {
} }
fn node_id(&'a self, n: &Crate) -> Id<'a> { fn node_id(&'a self, n: &Crate) -> Id<'a> {
Id::new(format!("_{:?}", n)).unwrap() let id = n.as_id().as_u32();
Id::new(format!("_{:?}", id)).unwrap()
} }
fn node_shape(&'a self, _node: &Crate) -> Option<LabelText<'a>> { fn node_shape(&'a self, _node: &Crate) -> Option<LabelText<'a>> {