mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-21 22:34:05 +00:00
Return label from write_node_label
.
Instead of appending an empty label. Because it's conceptually simpler.
This commit is contained in:
parent
a8ce44f7d9
commit
d921be92a4
@ -97,11 +97,10 @@ where
|
||||
}
|
||||
|
||||
fn node_label(&self, block: &Self::Node) -> dot::LabelText<'_> {
|
||||
let mut label = Vec::new();
|
||||
let mut cursor = self.cursor.borrow_mut();
|
||||
let mut fmt =
|
||||
BlockFormatter { cursor: &mut cursor, style: self.style, bg: Background::Light };
|
||||
fmt.write_node_label(&mut label, *block).unwrap();
|
||||
let label = fmt.write_node_label(*block).unwrap();
|
||||
|
||||
dot::LabelText::html(String::from_utf8(label).unwrap())
|
||||
}
|
||||
@ -172,7 +171,9 @@ where
|
||||
bg
|
||||
}
|
||||
|
||||
fn write_node_label(&mut self, w: &mut impl io::Write, block: BasicBlock) -> io::Result<()> {
|
||||
fn write_node_label(&mut self, block: BasicBlock) -> io::Result<Vec<u8>> {
|
||||
use std::io::Write;
|
||||
|
||||
// Sample output:
|
||||
// +-+-----------------------------------------------+
|
||||
// A | bb4 |
|
||||
@ -199,6 +200,9 @@ where
|
||||
// attributes. Make sure to test the output before trying to remove the redundancy.
|
||||
// Notably, `align` was found to have no effect when applied only to <table>.
|
||||
|
||||
let mut v = vec![];
|
||||
let w = &mut v;
|
||||
|
||||
let table_fmt = concat!(
|
||||
" border=\"1\"",
|
||||
" cellborder=\"1\"",
|
||||
@ -327,7 +331,9 @@ where
|
||||
_ => {}
|
||||
};
|
||||
|
||||
write!(w, "</table>")
|
||||
write!(w, "</table>")?;
|
||||
|
||||
Ok(v)
|
||||
}
|
||||
|
||||
fn write_block_header_simple(
|
||||
|
Loading…
Reference in New Issue
Block a user