todo!() is often used to quickly fill expressions that the developer currently does not have time/want to finish. However, use of todo!() often leads to the unreachable_code warning since it panics and the subsequent is not executable.
It is currently possible to suppress this warning at the crate level, #![allow(unreachable_code)], but this would result in suppressing legitimate unreachable code bugs as well. On the other hand, it is also possible to suppress this warning for each function that uses todo!(), but this introduces significantly more boilerplate (compare #[allow(unreachable_code)] 26 chars, need to move cursor to declaring block, vs todo!(), 7 chars in place).
According to the docs for todo!(), "todo! conveys an intent of implementing the functionality later". This implies that the TODO itself is already implies the current code is meant to be somewhat incorrect, and it is unlikely that a developer writing code after todo!() does not know it is unreachable.
Hence, subsequent code after todo!() shall not be considered unreachable, and the compiler shall suppress such warnings that would not have happened without todo!().
todo!()is often used to quickly fill expressions that the developer currently does not have time/want to finish. However, use oftodo!()often leads to theunreachable_codewarning since it panics and the subsequent is not executable.It is currently possible to suppress this warning at the crate level,
#![allow(unreachable_code)], but this would result in suppressing legitimate unreachable code bugs as well. On the other hand, it is also possible to suppress this warning for each function that usestodo!(), but this introduces significantly more boilerplate (compare#[allow(unreachable_code)]26 chars, need to move cursor to declaring block, vstodo!(), 7 chars in place).According to the docs for
todo!(), "todo!conveys an intent of implementing the functionality later". This implies that the TODO itself is already implies the current code is meant to be somewhat incorrect, and it is unlikely that a developer writing code aftertodo!()does not know it is unreachable.Hence, subsequent code after
todo!()shall not be considered unreachable, and the compiler shall suppress such warnings that would not have happened withouttodo!().