Commit 591fa1f 1 parent 6f72c02 commit 591fa1f Copy full SHA for 591fa1f
File tree 1 file changed +7
-9
lines changed
1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -353,16 +353,14 @@ impl<W: io::Write> io::Write for ProgressBarIter<W> {
353
353
354
354
impl < S : io:: Seek > io:: Seek for ProgressBarIter < S > {
355
355
fn seek ( & mut self , f : io:: SeekFrom ) -> io:: Result < u64 > {
356
- self . it . seek ( f) . map ( |pos| {
357
- let pos = if self . hold_max {
358
- self . progress . position ( ) . max ( pos)
359
- } else {
356
+ if let io:: SeekFrom :: Current ( 0 ) = f {
357
+ self . it . seek ( f)
358
+ } else {
359
+ self . it . seek ( f) . map ( |pos| {
360
+ self . progress . set_position ( self . hold_max . update_seek ( pos) ) ;
360
361
pos
361
- } ;
362
- self . progress . set_position ( pos) ;
363
- self . progress . set_position ( self . hold_max . update_seek ( pos) ) ;
364
- pos
365
- } )
362
+ } )
363
+ }
366
364
}
367
365
// Pass this through to preserve optimizations that the inner I/O object may use here
368
366
// Also avoid sending a set_position update when the position hasn't changed
You can’t perform that action at this time.
0 commit comments