diff --git a/lib.rs b/lib.rs index f1317e8..74cc498 100644 --- a/lib.rs +++ b/lib.rs @@ -295,6 +295,7 @@ #![cfg_attr(not(stage0), deny(warnings))] #![feature(str_escape)] +#![feature(question_mark)] use self::LabelText::*; @@ -662,7 +663,7 @@ pub fn render_opts<'a, N, E, G, W>(g: &'a G, { fn writeln(w: &mut W, arg: &[&str]) -> io::Result<()> { for &s in arg { - try!(w.write_all(s.as_bytes())); + w.write_all(s.as_bytes())?; } write!(w, "\n") } @@ -671,9 +672,9 @@ pub fn render_opts<'a, N, E, G, W>(g: &'a G, w.write_all(b" ") } - try!(writeln(w, &["digraph ", g.graph_id().as_slice(), " {"])); + writeln(w, &["digraph ", g.graph_id().as_slice(), " {"])?; for n in g.nodes().iter() { - try!(indent(w)); + indent(w)?; let id = g.node_id(n); let escaped = &g.node_label(n).to_dot_string(); @@ -702,12 +703,12 @@ pub fn render_opts<'a, N, E, G, W>(g: &'a G, } text.push(";"); - try!(writeln(w, &text)); + writeln(w, &text)?; } for e in g.edges().iter() { let escaped_label = &g.edge_label(e).to_dot_string(); - try!(indent(w)); + indent(w)?; let source = g.source(e); let target = g.target(e); let source_id = g.node_id(&source); @@ -729,7 +730,7 @@ pub fn render_opts<'a, N, E, G, W>(g: &'a G, } text.push(";"); - try!(writeln(w, &text)); + writeln(w, &text)?; } writeln(w, &["}"]) @@ -959,7 +960,7 @@ mod tests { let mut writer = Vec::new(); render(&g, &mut writer).unwrap(); let mut s = String::new(); - try!(Read::read_to_string(&mut &*writer, &mut s)); + Read::read_to_string(&mut &*writer, &mut s)?; Ok(s) }