]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/middle/cfg/graphviz.rs
auto merge of #15421 : catharsis/rust/doc-ffi-minor-fixes, r=alexcrichton
[rust.git] / src / librustc / middle / cfg / graphviz.rs
index 3d69e84b63c92e66609a55db2b17266c09dcc206..e9bcdff070de1764d9e8d0c47ce0c03b913364b9 100644 (file)
 pub struct LabelledCFG<'a>{
     pub ast_map: &'a ast_map::Map,
     pub cfg: &'a cfg::CFG,
-    pub name: StrBuf,
+    pub name: String,
 }
 
-fn replace_newline_with_backslash_l(s: StrBuf) -> StrBuf {
+fn replace_newline_with_backslash_l(s: String) -> String {
     // Replacing newlines with \\l causes each line to be left-aligned,
     // improving presentation of (long) pretty-printed expressions.
     if s.as_slice().contains("\n") {
@@ -43,7 +43,7 @@ fn replace_newline_with_backslash_l(s: StrBuf) -> StrBuf {
         if last_two.as_slice() != ['\\', 'l'] {
             s = s.append("\\l");
         }
-        s.to_strbuf()
+        s.to_string()
     } else {
         s
     }
@@ -64,7 +64,7 @@ fn node_label(&'a self, &(i, n): &Node<'a>) -> dot::LabelText<'a> {
         } else if n.data.id == ast::DUMMY_NODE_ID {
             dot::LabelStr("(dummy_node)".into_maybe_owned())
         } else {
-            let s = self.ast_map.node_to_str(n.data.id);
+            let s = self.ast_map.node_to_string(n.data.id);
             // left-aligns the lines
             let s = replace_newline_with_backslash_l(s);
             dot::EscStr(s.into_maybe_owned())
@@ -72,7 +72,7 @@ fn node_label(&'a self, &(i, n): &Node<'a>) -> dot::LabelText<'a> {
     }
 
     fn edge_label(&self, e: &Edge<'a>) -> dot::LabelText<'a> {
-        let mut label = StrBuf::new();
+        let mut label = String::new();
         let mut put_one = false;
         for (i, &node_id) in e.data.exiting_scopes.iter().enumerate() {
             if put_one {
@@ -80,7 +80,7 @@ fn edge_label(&self, e: &Edge<'a>) -> dot::LabelText<'a> {
             } else {
                 put_one = true;
             }
-            let s = self.ast_map.node_to_str(node_id);
+            let s = self.ast_map.node_to_string(node_id);
             // left-aligns the lines
             let s = replace_newline_with_backslash_l(s);
             label = label.append(format!("exiting scope_{} {}",
@@ -117,3 +117,4 @@ fn edges(&self) -> dot::Edges<'a, Edge<'a>> { self.cfg.edges() }
     fn source(&self, edge: &Edge<'a>) -> Node<'a> { self.cfg.source(edge) }
     fn target(&self, edge: &Edge<'a>) -> Node<'a> { self.cfg.target(edge) }
 }
+