1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
//! Chain Todo use core::fmt::Display; /// Chain call version of `todo!()` pub trait Todo { #[inline] /// Chain call version of `todo!()` fn todo(&self) -> ! { todo!() } } impl<T> Todo for T {} /// Chain call version of `todo!(msg)` pub trait TodoMsg { #[inline] /// Chain call version of `todo!(msg)` fn todo_msg<T: Display>(&self, msg: T) -> ! { todo!("{}", msg) } } impl<T> TodoMsg for T {} #[cfg(test)] mod tests { use super::*; #[test] #[should_panic] fn test_todo() { 1.todo(); } #[test] #[should_panic] fn test_todo_msg() { 1.todo_msg("asd"); } }