mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-15 22:51:13 -03:00
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:
15
src/timer.rs
15
src/timer.rs
@@ -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()`].
|
||||
|
||||
Reference in New Issue
Block a user