maud
maud copied to clipboard
Spurious `unreachable_code` warning when `todo!` or `unreachable!` is used inside `html!`
Thanks for the awesome Library! I'm using it in a couple of small projects, and really liking it!
One thing I was realizing today is that it doesn't seem like I can use 'panicking' macros like todo!
or unreachable!
from within the html!
macro, without a warning
For example in my blog I have some code to convert a Markdown AST to HTML using Maud. I wanted to use a match like this to get the correct heading element, but the following gives a warning about unreachable_code
. Adding allow[unreachable_code]
above the macro just leads to a new warning telling that allow is not needed
Since this is a warning its not the end of the world, but since I usually turn warnings into errors I've worked around this in my application by moving the panics out the macro
html! {
@match self.depth {
1 => h1 { (self.content) },
_ => todo!(),
}
}