Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

mermaid_render: Remove spurious debug assert (#58341)

Cameron Mcloughlin4eab06968b41
diff --git a/crates/mermaid_render/src/postprocess/accent_colors.rs b/crates/mermaid_render/src/postprocess/accent_colors.rs
index 6a3d397dcf7..3e811b4dce3 100644
--- a/crates/mermaid_render/src/postprocess/accent_colors.rs
+++ b/crates/mermaid_render/src/postprocess/accent_colors.rs
@@ -37,9 +37,7 @@ impl NodeTracker {
});
}
- pub fn finish_node(&mut self) {
- debug_assert!(self.building.is_some());
-
+ pub fn maybe_finish_node(&mut self) {
if let Some(rect) = self.building.take() {
self.rects.push(rect);
}
diff --git a/crates/mermaid_render/src/postprocess/accent_colors/class_diagram.rs b/crates/mermaid_render/src/postprocess/accent_colors/class_diagram.rs
index 9155c8fe243..17861673bb0 100644
--- a/crates/mermaid_render/src/postprocess/accent_colors/class_diagram.rs
+++ b/crates/mermaid_render/src/postprocess/accent_colors/class_diagram.rs
@@ -58,7 +58,7 @@ impl ClassDiagramAccents {
Event::End(e) if e.name().as_ref() == b"g" => {
if let Some(entry) = self.accent_g_stack.pop() {
if entry.is_some() {
- self.nodes.finish_node();
+ self.nodes.maybe_finish_node();
}
}
Ok(event)
diff --git a/crates/mermaid_render/src/postprocess/accent_colors/mindmap.rs b/crates/mermaid_render/src/postprocess/accent_colors/mindmap.rs
index c3a40fef06b..016571790a6 100644
--- a/crates/mermaid_render/src/postprocess/accent_colors/mindmap.rs
+++ b/crates/mermaid_render/src/postprocess/accent_colors/mindmap.rs
@@ -38,7 +38,7 @@ impl MindmapAccents {
Event::End(e) if e.name().as_ref() == b"g" => {
if let Some(maybe_section) = self.section_g_stack.pop() {
if maybe_section.is_some() {
- self.nodes.finish_node();
+ self.nodes.maybe_finish_node();
}
}
Ok(event)