File tree Expand file tree Collapse file tree 1 file changed +7
-13
lines changed Expand file tree Collapse file tree 1 file changed +7
-13
lines changed Original file line number Diff line number Diff line change @@ -115,9 +115,6 @@ impl ProgressBar {
115
115
}
116
116
117
117
self . item_position += delta;
118
-
119
- self . set_percent_complete ( ) ;
120
-
121
118
if self . format == ProgressFormat :: Json {
122
119
self . write_json ( ) ;
123
120
} else {
@@ -168,7 +165,6 @@ impl ProgressBar {
168
165
match self . format {
169
166
ProgressFormat :: Json => {
170
167
self . item_count = len;
171
- self . set_percent_complete ( ) ;
172
168
} ,
173
169
ProgressFormat :: Default => {
174
170
self . console_bar . pb_set_length ( len) ;
@@ -177,21 +173,19 @@ impl ProgressBar {
177
173
}
178
174
}
179
175
180
- fn write_json ( & self ) {
181
- if let Ok ( json) = serde_json:: to_string ( & self . progress_value ) {
182
- eprintln ! ( "{json}" ) ;
183
- } else {
184
- trace ! ( "{}" , t!( "progress.failedToSerialize" , json = self . progress_value : { : ?} ) ) ;
185
- }
186
- }
187
-
188
- fn set_percent_complete ( & mut self ) {
176
+ fn write_json ( & mut self ) {
189
177
if self . item_count > 0 {
190
178
self . progress_value . percent_complete = if self . item_position >= self . item_count {
191
179
100
192
180
} else {
193
181
u8:: try_from ( ( self . item_position * 100 ) / self . item_count ) . unwrap_or ( 100 )
194
182
} ;
195
183
}
184
+
185
+ if let Ok ( json) = serde_json:: to_string ( & self . progress_value ) {
186
+ eprintln ! ( "{json}" ) ;
187
+ } else {
188
+ trace ! ( "{}" , t!( "progress.failedToSerialize" , json = self . progress_value : { : ?} ) ) ;
189
+ }
196
190
}
197
191
}
You can’t perform that action at this time.
0 commit comments