diff options
author | Jesse Luehrs <doy@tozt.net> | 2023-03-26 00:10:35 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2023-03-26 00:10:35 -0400 |
commit | 93e6a9a08aec3cbb8b847a815ad905aa0d0bffca (patch) | |
tree | 9c9d3922475e846bd11293d91ddee36b56302355 /src/verbose.rs | |
parent | f252f4c6595421339cb3119f1ca8ef491077f365 (diff) | |
download | fancy-prompt-93e6a9a08aec3cbb8b847a815ad905aa0d0bffca.tar.gz fancy-prompt-93e6a9a08aec3cbb8b847a815ad905aa0d0bffca.zip |
fmt
Diffstat (limited to 'src/verbose.rs')
-rw-r--r-- | src/verbose.rs | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/verbose.rs b/src/verbose.rs index 8f23c03..1b02799 100644 --- a/src/verbose.rs +++ b/src/verbose.rs @@ -2,11 +2,13 @@ use std; #[cfg(feature = "verbose")] -pub static mut STACK: Option<Vec<(String, std::time::Instant, std::time::Instant)>> = None; +pub static mut STACK: Option< + Vec<(String, std::time::Instant, std::time::Instant)>, +> = None; #[cfg(feature = "verbose")] macro_rules! start_talking_about_time { - ($category:expr) => ( + ($category:expr) => { use std; use verbose; unsafe { @@ -17,12 +19,12 @@ macro_rules! start_talking_about_time { stack.push((String::from(category), now.clone(), now.clone())); eprintln!("{}starting {}", " ".repeat(len), category); } - ) + }; } #[cfg(feature = "verbose")] macro_rules! talk_about_time { - ($what:expr) => ( + ($what:expr) => { unsafe { let stack = verbose::STACK.get_or_insert_with(|| Vec::new()); let len = stack.len(); @@ -38,12 +40,12 @@ macro_rules! talk_about_time { ); last.1 = std::time::Instant::now(); } - ) + }; } #[cfg(feature = "verbose")] macro_rules! stop_talking_about_time { - () => ( + () => { unsafe { let stack = verbose::STACK.get_or_insert_with(|| Vec::new()); let last = stack.pop().unwrap(); @@ -57,20 +59,20 @@ macro_rules! stop_talking_about_time { elapsed.subsec_nanos() ); } - ) + }; } #[cfg(not(feature = "verbose"))] macro_rules! start_talking_about_time { - ($e:expr) => () + ($e:expr) => {}; } #[cfg(not(feature = "verbose"))] macro_rules! talk_about_time { - ($e:expr) => () + ($e:expr) => {}; } #[cfg(not(feature = "verbose"))] macro_rules! stop_talking_about_time { - () => () + () => {}; } |