Check for unsupported "time &" in the proper place

This means we can detect this error also for simple blocks.

While at it do some cleanup in the area.
This commit is contained in:
Johannes Altmanninger
2024-05-03 09:31:55 +02:00
parent a126d2aeba
commit 4e816212a1
3 changed files with 26 additions and 28 deletions

View File

@@ -30,17 +30,12 @@ struct TimerSnapshot {
cpu_children: libc::rusage,
}
/// If `enabled`, create a `TimerSnapshot` and return a `PrintElapsedOnDrop` object that will print
/// upon being dropped the delta between now and the time that it is dropped at. Otherwise return
/// `None`.
pub fn push_timer(enabled: bool) -> Option<PrintElapsedOnDrop> {
if !enabled {
return None;
}
Some(PrintElapsedOnDrop {
/// Create a `TimerSnapshot` and return a `PrintElapsedOnDrop` object that will print upon
/// being dropped the delta between now and the time that it is dropped at.
pub fn push_timer() -> PrintElapsedOnDrop {
PrintElapsedOnDrop {
start: TimerSnapshot::take(),
})
}
}
/// An enumeration of supported libc rusage types used by [`getrusage()`].