File tree Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -78,26 +78,22 @@ impl ConcatSource {
7878
7979impl Source for ConcatSource {
8080 fn source ( & self ) -> Cow < str > {
81- let all = self . children . iter ( ) . fold ( String :: new ( ) , |mut acc, cur| {
82- acc. push_str ( & cur. source ( ) ) ;
83- acc
84- } ) ;
81+ let all = self . children . iter ( ) . map ( |child| child. source ( ) ) . collect ( ) ;
8582 Cow :: Owned ( all)
8683 }
8784
8885 fn buffer ( & self ) -> Cow < [ u8 ] > {
89- let all = self . children . iter ( ) . fold ( Vec :: new ( ) , |mut acc, cur| {
90- acc. extend ( & * cur. buffer ( ) ) ;
91- acc
92- } ) ;
86+ let all = self
87+ . children
88+ . iter ( )
89+ . map ( |child| child. buffer ( ) )
90+ . collect :: < Vec < _ > > ( )
91+ . concat ( ) ;
9392 Cow :: Owned ( all)
9493 }
9594
9695 fn size ( & self ) -> usize {
97- self . children . iter ( ) . fold ( 0 , |mut acc, cur| {
98- acc += cur. size ( ) ;
99- acc
100- } )
96+ self . children . iter ( ) . map ( |child| child. size ( ) ) . sum ( )
10197 }
10298
10399 fn map ( & self , options : & MapOptions ) -> Option < SourceMap > {
You can’t perform that action at this time.
0 commit comments