]> git.lizzy.rs Git - rust.git/blobdiff - src/checkstyle.rs
Merge pull request #3035 from topecongiro/issue-3006
[rust.git] / src / checkstyle.rs
index 19d737cd4c2497ce89fbd878f7fb23c0d1885cec..e252e71f8298482cc592a0215939d0982f3ef86e 100644 (file)
 
 use rustfmt_diff::{DiffLine, Mismatch};
 
-pub fn output_header<T>(out: &mut T) -> Result<(), io::Error>
-where
-    T: Write,
-{
+/// The checkstyle header - should be emitted before the output of Rustfmt.
+///
+/// Note that emitting checkstyle output is not stable and may removed in a
+/// future version of Rustfmt.
+pub fn header() -> String {
     let mut xml_heading = String::new();
     xml_heading.push_str("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
     xml_heading.push_str("\n");
     xml_heading.push_str("<checkstyle version=\"4.3\">");
-    write!(out, "{}", xml_heading)
+    xml_heading
 }
 
-pub fn output_footer<T>(out: &mut T) -> Result<(), io::Error>
-where
-    T: Write,
-{
-    let mut xml_tail = String::new();
-    xml_tail.push_str("</checkstyle>\n");
-    write!(out, "{}", xml_tail)
+/// The checkstyle footer - should be emitted after the output of Rustfmt.
+///
+/// Note that emitting checkstyle output is not stable and may removed in a
+/// future version of Rustfmt.
+pub fn footer() -> String {
+    "</checkstyle>\n".to_owned()
 }
 
 pub fn output_checkstyle_file<T>(