-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleanup for libgraphviz #46784
Cleanup for libgraphviz #46784
Conversation
r? @pnkfelix (rust_highfive has picked a reviewer for you, use r? to override) |
src/libgraphviz/lib.rs
Outdated
text.push("[shape="); | ||
text.push(&shape); | ||
text.push("]"); | ||
write!(text, "[shape={}]", &s.to_dot_string()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing ?
src/libgraphviz/lib.rs
Outdated
} | ||
|
||
text.push(";"); | ||
writeln(w, &text)?; | ||
write!(text, ";"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing ?
src/libgraphviz/lib.rs
Outdated
let source = g.source(e); | ||
let target = g.target(e); | ||
let source_id = g.node_id(&source); | ||
let target_id = g.node_id(&target); | ||
|
||
let mut text = vec![source_id.as_slice(), " -> ", target_id.as_slice()]; | ||
let mut text = ::std::io::Cursor::new(Vec::new()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are cursors necessary? Can't you write to vecs directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't know you could write to them without cursor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nor did i!
As it can't fail. (Its on the |
src/libgraphviz/lib.rs
Outdated
text.push(";"); | ||
writeln(w, &text)?; | ||
write!(text, ";").unwrap(); | ||
w.write_all(&text[..])?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change removes a newline, which breaks some tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm now. Can you just squash the commits into one?
Rebased |
for n in g.nodes().iter() { | ||
indent(w)?; | ||
write!(w, " ")?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(personally I usually prefer a function like indent
over having to double-check that the string contents all match up, but since there are only two calls to indent
I'm not going to make a fuss)
@bors r+ rollup |
📌 Commit 2e2defd has been approved by |
Cleanup for libgraphviz
No description provided.