1- use std:: io:: { self , prelude :: Write } ;
1+ use std:: io;
22use std:: time:: Duration ;
33
44use super :: OutputFormatter ;
55use crate :: {
6- console:: { ConsoleTestDiscoveryState , ConsoleTestState , OutputLocation } ,
6+ console:: { ConsoleTestDiscoveryState , ConsoleTestState , Output } ,
77 test_result:: TestResult ,
88 time,
99 types:: { TestDesc , TestType } ,
1010} ;
1111
12- pub struct JunitFormatter < T > {
13- out : OutputLocation < T > ,
12+ pub struct JunitFormatter < ' a > {
13+ out : & ' a mut dyn Output ,
1414 results : Vec < ( TestDesc , TestResult , Duration , Vec < u8 > ) > ,
1515}
1616
17- impl < T : Write > JunitFormatter < T > {
18- pub fn new ( out : OutputLocation < T > ) -> Self {
17+ impl < ' a > JunitFormatter < ' a > {
18+ pub fn new ( out : & ' a mut dyn Output ) -> Self {
1919 Self { out, results : Vec :: new ( ) }
2020 }
2121
2222 fn write_message ( & mut self , s : & str ) -> io:: Result < ( ) > {
2323 assert ! ( !s. contains( '\n' ) ) ;
2424
25- self . out . write_all ( s . as_ref ( ) )
25+ self . out . write_plain ( s )
2626 }
2727}
2828
@@ -38,7 +38,7 @@ fn str_to_cdata(s: &str) -> String {
3838 format ! ( "<![CDATA[{}]]>" , escaped_output)
3939}
4040
41- impl < T : Write > OutputFormatter for JunitFormatter < T > {
41+ impl OutputFormatter for JunitFormatter < ' _ > {
4242 fn write_discovery_start ( & mut self ) -> io:: Result < ( ) > {
4343 Err ( io:: Error :: new ( io:: ErrorKind :: NotFound , "Not yet implemented!" ) )
4444 }
@@ -179,7 +179,7 @@ impl<T: Write> OutputFormatter for JunitFormatter<T> {
179179 self . write_message ( "</testsuite>" ) ?;
180180 self . write_message ( "</testsuites>" ) ?;
181181
182- self . out . write_all ( b "\n ") ?;
182+ self . out . write_plain ( "\n " ) ?;
183183
184184 Ok ( state. failed == 0 )
185185 }
0 commit comments