From: Ian Jackson Date: Tue, 3 May 2022 19:10:45 +0000 (+0100) Subject: Provide todo function X-Git-Tag: otter-1.1.0~305 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=9f1ef7773717dd7fe6d92e187d587c407fae5f94;p=otter.git Provide todo function Using the todo!() macro in fehler-annotated functions generates annoying dead code warnings. And, this will fail to build in release mode - yay! Signed-off-by: Ian Jackson --- diff --git a/Cargo.lock b/Cargo.lock index 27001818..e43cd78a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2708,6 +2708,7 @@ dependencies = [ "ordered-float", "otter-base", "parking_lot", + "paste", "percent-encoding", "pwd", "rand 0.8.5", diff --git a/Cargo.toml b/Cargo.toml index e45d45a8..9c52ca20 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -66,6 +66,7 @@ num-traits="0.2" once_cell="1" openssh-keys="0.5" ordered-float="2" +paste="1" parking_lot="0.12" percent-encoding="2" pwd="1" diff --git a/src/prelude.rs b/src/prelude.rs index 6717aa23..b2587aa0 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -83,6 +83,7 @@ pub use nix::time::clock_gettime; pub use num_derive::{ToPrimitive, FromPrimitive}; pub use num_traits::{Bounded, FromPrimitive, ToPrimitive}; pub use ordered_float::OrderedFloat; +pub use paste::paste; pub use percent_encoding::percent_decode_str; pub use percent_encoding::utf8_percent_encode; pub use percent_encoding::NON_ALPHANUMERIC; diff --git a/src/utils.rs b/src/utils.rs index fc0967d5..093c0d28 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -768,6 +768,11 @@ macro_rules! want_let { //========== miscellaneous macros ========== +paste!{ + #[cfg(debug_assertions)] + pub fn []() -> T { panic!("todo item triggered") } +} + #[macro_export] macro_rules! trace_dbg { ($msg:expr $(,$val:expr)*) => {