diff --git a/src/checkstyle.rs b/src/checkstyle.rs
index 1eb74a99bbf..2a276dce120 100644
--- a/src/checkstyle.rs
+++ b/src/checkstyle.rs
@@ -9,37 +9,31 @@
// except according to those terms.
use rustfmt_diff::{Mismatch, DiffLine};
use std::io::{self, Write, Read, stdout};
-use WriteMode;
+use config::WriteMode;
pub fn output_heading(mode: WriteMode) -> Result<(), io::Error> {
let stdout = stdout();
let mut stdout = stdout.lock();
- match mode {
- WriteMode::Checkstyle => {
- let mut xml_heading = String::new();
- xml_heading.push_str("");
- xml_heading.push_str("\n");
- xml_heading.push_str("");
- try!(write!(stdout, "{}", xml_heading));
- Ok(())
- }
- _ => Ok(()),
+ if mode == WriteMode::Checkstyle {
+ let mut xml_heading = String::new();
+ xml_heading.push_str("");
+ xml_heading.push_str("\n");
+ xml_heading.push_str("");
+ try!(write!(stdout, "{}", xml_heading));
}
+ Ok(())
}
pub fn output_footing(mode: WriteMode) -> Result<(), io::Error> {
let stdout = stdout();
let mut stdout = stdout.lock();
- match mode {
- WriteMode::Checkstyle => {
- let mut xml_tail = String::new();
- xml_tail.push_str("");
- try!(write!(stdout, "{}", xml_tail));
- Ok(())
- }
- _ => Ok(()),
+ if mode == WriteMode::Checkstyle {
+ let mut xml_tail = String::new();
+ xml_tail.push_str("");
+ try!(write!(stdout, "{}", xml_tail));
}
+ Ok(())
}
pub fn output_checkstyle_file(mut writer: T,
diff --git a/src/filemap.rs b/src/filemap.rs
index 92d4267f6e1..a2cba78ae96 100644
--- a/src/filemap.rs
+++ b/src/filemap.rs
@@ -161,14 +161,6 @@ pub fn write_file(text: &StringBuffer,
// Output the XML tags for the lines that are different.
try!(output_checkstyle_file(stdout, filename, diff));
}
- WriteMode::Return => {
- // io::Write is not implemented for String, working around with
- // Vec
- let mut v = Vec::new();
- try!(write_system_newlines(&mut v, text, config));
- // won't panic, we are writing correct utf8
- return Ok(Some(String::from_utf8(v).unwrap()));
- }
}
Ok(None)