diff options
| author | bors <bors@rust-lang.org> | 2020-11-03 09:19:01 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-11-03 09:19:01 +0000 |
| commit | 8e8939b8045b7af6076fb718e2e298844aaf4650 (patch) | |
| tree | c132dcf8bda4c2b4c24c3f37ad4266507e02a2d8 /compiler/rustc_graphviz/src/lib.rs | |
| parent | d662f808550acadc5980969e1826a653ec35b408 (diff) | |
| parent | a8803d3c04b25928b5ec42b3147c8002de7ac64f (diff) | |
Auto merge of #78489 - bugadani:array, r=estebank
Minor cleanup around incremental compilation * Remove some short lived vectors * Fix some typos * Avoid some reallocations
Diffstat (limited to 'compiler/rustc_graphviz/src/lib.rs')
| -rw-r--r-- | compiler/rustc_graphviz/src/lib.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/rustc_graphviz/src/lib.rs b/compiler/rustc_graphviz/src/lib.rs index 76e33bed97f..d332466160c 100644 --- a/compiler/rustc_graphviz/src/lib.rs +++ b/compiler/rustc_graphviz/src/lib.rs @@ -653,13 +653,13 @@ where writeln!(w, r#" edge[{}];"#, content_attrs_str)?; } + let mut text = Vec::new(); for n in g.nodes().iter() { write!(w, " ")?; let id = g.node_id(n); let escaped = &g.node_label(n).to_dot_string(); - let mut text = Vec::new(); write!(text, "{}", id.as_slice()).unwrap(); if !options.contains(&RenderOption::NoNodeLabels) { @@ -677,6 +677,8 @@ where writeln!(text, ";").unwrap(); w.write_all(&text[..])?; + + text.clear(); } for e in g.edges().iter() { @@ -687,7 +689,6 @@ where let source_id = g.node_id(&source); let target_id = g.node_id(&target); - let mut text = Vec::new(); write!(text, "{} -> {}", source_id.as_slice(), target_id.as_slice()).unwrap(); if !options.contains(&RenderOption::NoEdgeLabels) { @@ -701,6 +702,8 @@ where writeln!(text, ";").unwrap(); w.write_all(&text[..])?; + + text.clear(); } writeln!(w, "}}") |
