@@ -393,7 +393,7 @@ impl Rectangle {
393393///
394394/// [differential flame graph]: http://www.brendangregg.com/blog/2014-11-09/differential-flame-graphs.html
395395#[ allow( clippy:: cognitive_complexity) ]
396- pub fn from_lines < ' a , I , W > ( opt : & mut Options < ' _ > , lines : I , writer : W ) -> quick_xml :: Result < ( ) >
396+ pub fn from_lines < ' a , I , W > ( opt : & mut Options < ' _ > , lines : I , writer : W ) -> io :: Result < ( ) >
397397where
398398 I : IntoIterator < Item = & ' a str > ,
399399 W : Write ,
@@ -500,10 +500,10 @@ where
500500 ) ?;
501501 svg. write_event ( Event :: End ( BytesEnd :: new ( "svg" ) ) ) ?;
502502 svg. write_event ( Event :: Eof ) ?;
503- return Err ( quick_xml :: Error :: Io ( io:: Error :: new (
503+ return Err ( io:: Error :: new (
504504 io:: ErrorKind :: InvalidData ,
505505 "No stack counts found" ,
506- ) ) ) ;
506+ ) ) ;
507507 }
508508
509509 let image_width = opt. image_width . unwrap_or ( DEFAULT_IMAGE_WIDTH ) as f64 ;
@@ -724,9 +724,9 @@ where
724724
725725 buffer. clear ( ) ;
726726 if has_href {
727- svg. write_event ( & cache_a_end) ?;
727+ svg. write_event ( cache_a_end. borrow ( ) ) ?;
728728 } else {
729- svg. write_event ( & cache_g_end) ?;
729+ svg. write_event ( cache_g_end. borrow ( ) ) ?;
730730 }
731731 }
732732
@@ -746,7 +746,7 @@ fn write_container_start<'a, W: Write>(
746746 cache_g : & mut Event < ' _ > ,
747747 frame : & merge:: TimedFrame < ' _ > ,
748748 mut title : & ' a str ,
749- ) -> quick_xml :: Result < ( bool , & ' a str ) > {
749+ ) -> io :: Result < ( bool , & ' a str ) > {
750750 let frame_attributes = opt
751751 . func_frameattrs
752752 . frameattrs_for_func ( frame. location . function ) ;
@@ -755,18 +755,18 @@ fn write_container_start<'a, W: Write>(
755755 if let Some ( frame_attributes) = frame_attributes {
756756 if frame_attributes. attrs . contains_key ( "xlink:href" ) {
757757 write_container_attributes ( cache_a, frame_attributes) ;
758- svg. write_event ( cache_a) ?;
758+ svg. write_event ( cache_a. borrow ( ) ) ?;
759759 has_href = true ;
760760 } else {
761761 write_container_attributes ( cache_g, frame_attributes) ;
762- svg. write_event ( cache_g) ?;
762+ svg. write_event ( cache_g. borrow ( ) ) ?;
763763 }
764764 if let Some ( ref t) = frame_attributes. title {
765765 title = t. as_str ( ) ;
766766 }
767767 } else if let Event :: Start ( ref mut c) = cache_g {
768768 c. clear_attributes ( ) ;
769- svg. write_event ( cache_g) ?;
769+ svg. write_event ( cache_g. borrow ( ) ) ?;
770770 }
771771
772772 Ok ( ( has_href, title) )
@@ -780,10 +780,10 @@ fn write_container_start<'a, W: Write>(
780780 cache_g : & mut Event < ' _ > ,
781781 _frame : & merge:: TimedFrame < ' _ > ,
782782 title : & ' a str ,
783- ) -> quick_xml :: Result < ( bool , & ' a str ) > {
783+ ) -> io :: Result < ( bool , & ' a str ) > {
784784 if let Event :: Start ( ref mut c) = cache_g {
785785 c. clear_attributes ( ) ;
786- svg. write_event ( & cache_g) ?;
786+ svg. write_event ( cache_g. borrow ( ) ) ?;
787787 }
788788
789789 Ok ( ( false , title) )
@@ -810,7 +810,7 @@ fn write_container_attributes(event: &mut Event<'_>, frame_attributes: &FrameAtt
810810/// See [`from_lines`] for the expected format of each line.
811811///
812812/// The resulting flame graph will be written out to `writer` in SVG format.
813- pub fn from_reader < R , W > ( opt : & mut Options < ' _ > , reader : R , writer : W ) -> quick_xml :: Result < ( ) >
813+ pub fn from_reader < R , W > ( opt : & mut Options < ' _ > , reader : R , writer : W ) -> io :: Result < ( ) >
814814where
815815 R : Read ,
816816 W : Write ,
@@ -823,17 +823,15 @@ where
823823/// See [`from_lines`] for the expected format of each line.
824824///
825825/// The resulting flame graph will be written out to `writer` in SVG format.
826- pub fn from_readers < R , W > ( opt : & mut Options < ' _ > , readers : R , writer : W ) -> quick_xml :: Result < ( ) >
826+ pub fn from_readers < R , W > ( opt : & mut Options < ' _ > , readers : R , writer : W ) -> io :: Result < ( ) >
827827where
828828 R : IntoIterator ,
829829 R :: Item : Read ,
830830 W : Write ,
831831{
832832 let mut input = String :: new ( ) ;
833833 for mut reader in readers {
834- reader
835- . read_to_string ( & mut input)
836- . map_err ( quick_xml:: Error :: Io ) ?;
834+ reader. read_to_string ( & mut input) ?;
837835 }
838836 from_lines ( opt, input. lines ( ) , writer)
839837}
@@ -842,17 +840,13 @@ where
842840/// and write the result to provided `writer`.
843841///
844842/// If files is empty, STDIN will be used as input.
845- pub fn from_files < W : Write > (
846- opt : & mut Options < ' _ > ,
847- files : & [ PathBuf ] ,
848- writer : W ,
849- ) -> quick_xml:: Result < ( ) > {
843+ pub fn from_files < W : Write > ( opt : & mut Options < ' _ > , files : & [ PathBuf ] , writer : W ) -> io:: Result < ( ) > {
850844 if files. is_empty ( ) || files. len ( ) == 1 && files[ 0 ] . to_str ( ) == Some ( "-" ) {
851845 let stdin = io:: stdin ( ) ;
852846 let r = BufReader :: with_capacity ( 128 * 1024 , stdin. lock ( ) ) ;
853847 from_reader ( opt, r, writer)
854848 } else if files. len ( ) == 1 {
855- let r = File :: open ( & files[ 0 ] ) . map_err ( quick_xml :: Error :: Io ) ?;
849+ let r = File :: open ( & files[ 0 ] ) ?;
856850 from_reader ( opt, r, writer)
857851 } else {
858852 let stdin = io:: stdin ( ) ;
@@ -866,7 +860,7 @@ pub fn from_files<W: Write>(
866860 stdin_added = true ;
867861 }
868862 } else {
869- let r = File :: open ( infile) . map_err ( quick_xml :: Error :: Io ) ?;
863+ let r = File :: open ( infile) ?;
870864 readers. push ( Box :: new ( r) ) ;
871865 }
872866 }
@@ -892,7 +886,7 @@ fn filled_rectangle<W: Write>(
892886 rect : & Rectangle ,
893887 color : Color ,
894888 cache_rect : & mut Event < ' _ > ,
895- ) -> quick_xml :: Result < ( ) > {
889+ ) -> io :: Result < ( ) > {
896890 let x = write ! ( buffer, "{:.4}%" , rect. x1_pct) ;
897891 let y = write_usize ( buffer, rect. y1 ) ;
898892 let width = write ! ( buffer, "{:.4}%" , rect. width_pct( ) ) ;
@@ -916,7 +910,7 @@ fn filled_rectangle<W: Write>(
916910 } else {
917911 unreachable ! ( "cache wrapper was of wrong type: {:?}" , cache_rect) ;
918912 }
919- svg. write_event ( cache_rect)
913+ svg. write_event ( cache_rect. borrow ( ) )
920914}
921915
922916fn write_usize ( buffer : & mut StrStack , value : usize ) -> usize {
0 commit comments