From 25dfa2f5f10f7f4ae53bd385ed7045f0ce63eb43 Mon Sep 17 00:00:00 2001 From: Shimun Date: Mon, 25 Mar 2019 17:16:43 +0100 Subject: [PATCH] handle write error [CI SKIP] --- src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 6bbb467..48ef5ff 100644 --- a/src/main.rs +++ b/src/main.rs @@ -52,7 +52,7 @@ fn main() -> Result<(), Box> { }; let mut out: Box = if let Some(path) = opt.output { - let mut file = File::open(&path)?; + let file = File::open(&path)?; Box::new(file) } else { Box::new(stdout()) @@ -82,7 +82,7 @@ fn main() -> Result<(), Box> { // Let's get the actual text in this text node. A text node wraps around // a RefCell, so we need to call borrow() to get a &str out. //let text = text_node.as_text().unwrap().borrow(); - write!(out, "{}", serialize_node(as_node)?); + write!(out, "{}", serialize_node(as_node)?)?; /*if let Some(child) = as_node.first_child() { //TODO: Convert Nodes to String, as this only works for Nodes containing plain text