Skip to content

Commit aae1416

Browse files
committed
Style update.
1 parent 6c6aa97 commit aae1416

File tree

1 file changed

+38
-34
lines changed

1 file changed

+38
-34
lines changed

src/cargo/core/compiler/timings.rs

Lines changed: 38 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,14 @@ impl<'a, 'cfg> Timings<'a, 'cfg> {
179179
// `id` may not always be active. "fresh" units unconditionally
180180
// generate `Message::Finish`, but this active map only tracks dirty
181181
// units.
182-
if let Some(unit_time) = self.active.get_mut(&id) {
183-
let t = d_as_f64(self.start.elapsed());
184-
unit_time.rmeta_time = Some(t - unit_time.start);
185-
assert!(unit_time.unlocked_rmeta_units.is_empty());
186-
unit_time.unlocked_rmeta_units.extend(unlocked);
187-
}
182+
let unit_time = match self.active.get_mut(&id) {
183+
Some(ut) => ut,
184+
None => return,
185+
};
186+
let t = d_as_f64(self.start.elapsed());
187+
unit_time.rmeta_time = Some(t - unit_time.start);
188+
assert!(unit_time.unlocked_rmeta_units.is_empty());
189+
unit_time.unlocked_rmeta_units.extend(unlocked);
188190
}
189191

190192
/// Mark that a unit has finished running.
@@ -193,36 +195,38 @@ impl<'a, 'cfg> Timings<'a, 'cfg> {
193195
return;
194196
}
195197
// See note above in `unit_rmeta_finished`, this may not always be active.
196-
if let Some(mut unit_time) = self.active.remove(&id) {
197-
let t = d_as_f64(self.start.elapsed());
198-
unit_time.duration = t - unit_time.start;
199-
assert!(unit_time.unlocked_units.is_empty());
200-
unit_time.unlocked_units.extend(unlocked);
201-
if self.report_info {
202-
let msg = format!(
203-
"{}{} in {:.1}s",
204-
unit_time.name_ver(),
205-
unit_time.target,
206-
unit_time.duration
207-
);
208-
let _ =
209-
self.config
210-
.shell()
211-
.status_with_color("Completed", msg, termcolor::Color::Cyan);
212-
}
213-
if self.report_json {
214-
let msg = machine_message::TimingInfo {
215-
package_id: unit_time.unit.pkg.package_id(),
216-
target: unit_time.unit.target,
217-
mode: unit_time.unit.mode,
218-
duration: unit_time.duration,
219-
rmeta_time: unit_time.rmeta_time,
220-
}
221-
.to_json_string();
222-
self.config.shell().stdout_println(msg);
198+
let mut unit_time = match self.active.remove(&id) {
199+
Some(ut) => ut,
200+
None => return,
201+
};
202+
let t = d_as_f64(self.start.elapsed());
203+
unit_time.duration = t - unit_time.start;
204+
assert!(unit_time.unlocked_units.is_empty());
205+
unit_time.unlocked_units.extend(unlocked);
206+
if self.report_info {
207+
let msg = format!(
208+
"{}{} in {:.1}s",
209+
unit_time.name_ver(),
210+
unit_time.target,
211+
unit_time.duration
212+
);
213+
let _ = self
214+
.config
215+
.shell()
216+
.status_with_color("Completed", msg, termcolor::Color::Cyan);
217+
}
218+
if self.report_json {
219+
let msg = machine_message::TimingInfo {
220+
package_id: unit_time.unit.pkg.package_id(),
221+
target: unit_time.unit.target,
222+
mode: unit_time.unit.mode,
223+
duration: unit_time.duration,
224+
rmeta_time: unit_time.rmeta_time,
223225
}
224-
self.unit_times.push(unit_time);
226+
.to_json_string();
227+
self.config.shell().stdout_println(msg);
225228
}
229+
self.unit_times.push(unit_time);
226230
}
227231

228232
/// This is called periodically to mark the concurrency of internal structures.

0 commit comments

Comments
 (0)